Skip to content

Commit 9bb256f

Browse files
authored
Update Exam_Notes.md
1 parent 9ee9e59 commit 9bb256f

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

Exam_Notes.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,38 @@ class test{
9797
}
9898
```
9999

100+
# Algorithm in collections
101+
``` java:
102+
103+
import java.util.*;
104+
105+
class test{
106+
public static void main(String []argc){
107+
ArrayList<Integer> lis = new ArrayList<Integer>();
108+
lis.add(86);
109+
lis.add(54);
110+
lis.add(29);
111+
lis.add(66);
112+
lis.add(73);
113+
lis.add(16);
114+
lis.add(1);
115+
System.out.println("Array Data : " + lis);
116+
Collections.sort(lis);
117+
System.out.println("After Sort Algo: " + lis);
118+
Collections.shuffle(lis);
119+
System.out.println("After Shuffle Algo: " + lis);
120+
Collections.reverse(lis);
121+
System.out.println("After Reverse Algo: " + lis);
122+
Collections.swap(lis,0,1);
123+
System.out.println("After Swap Algo: " + lis);
124+
Collections.rotate(lis,2);
125+
System.out.println("After Rotate Algo: " + lis);
126+
Collections.frequency(lis,5);
127+
System.out.println("After frequency Algo : " + lis);
128+
129+
}
130+
}
131+
```
100132

101133

102134

0 commit comments

Comments
 (0)