You are viewing a single comment's thread. Return to all comments →
class Result {
public static List<Integer> quickSort(List<Integer> arr) { int key = arr.get(0); int i = 0; for (int j = 1; j < arr.size(); j++) { if (arr.get(j) <= key) { i++; swap(arr, i, j); } } swap(arr, 0, i); return arr; } private static void swap(List<Integer> arr, int i, int j) { int temp = arr.get(i); arr.set(i, arr.get(j)); arr.set(j, temp); }
}
Seems like cookies are disabled on this browser, please enable them to open this website
Quicksort 1 - Partition
You are viewing a single comment's thread. Return to all comments →
class Result {
}