1ArrayList -- sorting in ascending
2Write a method that can sort the ArrayList in Ascending order without using the sort method
3
4Solution:
5public static void SortingArrayListAsc(List<Integer> list) {
6 for (int i = 0; i < list.size(); i++) {
7 for (int j = 0; j < list.size(); j++) {
8 if (list.get(i) < list.get(j)) {
9 Integer temp = list.get(i);
10 list.set(i, list.get(j));
11 list.set(j, temp);
12 }
13 }
14 }
15 }