MCPcopy Create free account
hub / github.com/algorithmzuo/algorithm-journey / sort

Method sort

src/class187/Code02_Cobweb1.java:146–160  ·  view source on GitHub ↗
(int[] key, long[] path, int l, int r)

Source from the content-addressed store, hash-verified

144 }
145
146 public static void sort(int[] key, long[] path, int l, int r) {
147 if (l >= r) return;
148 int i = l, j = r, pivot = key[(l + r) >> 1];
149 while (i <= j) {
150 while (key[i] < pivot) i++;
151 while (key[j] > pivot) j--;
152 if (i <= j) {
153 int tmp1 = key[i]; key[i] = key[j]; key[j] = tmp1;
154 long tmp2 = path[i]; path[i] = path[j]; path[j] = tmp2;
155 i++; j--;
156 }
157 }
158 sort(key, path, l, j);
159 sort(key, path, i, r);
160 }
161
162 public static int lessThan(int[] arr, int len, int num) {
163 int l = 1, r = len, mid, ans = 0;

Callers 14

calcMethod · 0.95
mainMethod · 0.45
connectMethod · 0.45
connectMethod · 0.45
kruskalMethod · 0.45
prepareMethod · 0.45
connectMethod · 0.45
calcMethod · 0.45
calcMethod · 0.45
mainMethod · 0.45
calcMethod · 0.45
prepareMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected