Lines Matching refs:arr
42 * Stuff[] arr = ...;
43 * ArraySorter.sort(arr, new Comparer() {
58 static public void sort(Object[] arr, Comparer c) {
59 quickSort(arr, c, 0, arr.length-1);
66 static public void sortArrayOfStrings(Object[] arr) {
67 sort(arr, new Comparer() {
75 static private void swap(Object[] arr, int a, int b) {
76 Object tmp = arr[a];
77 arr[a] = arr[b];
78 arr[b] = tmp;
82 // Sorts arr between from and to, inclusive. This is a quick, off-the-top-
89 static private void quickSort(Object[] arr, Comparer c, int from, int to) {
94 swap(arr, mid, from);
95 Object pivot = arr[from]; // Simple-minded, but reasonable
101 // arr[i] <= pivot for all i < low
102 // arr[i] > pivot for all i > high
106 int cmp = c.compare(arr[low], pivot);
107 if (cmp <= 0) { // arr[low] <= pivot
115 // arr[high] > pivot:
116 c2 = c.compare(arr[high], pivot);
128 swap(arr, low, high);
142 swap(arr, from, highestBelowPivot);
143 quickSort(arr, c, from, highestBelowPivot-1);
145 quickSort(arr, c, high+1, to);