MCPcopy Create free account
hub / github.com/ReadyTalk/avian / siftDown

Method siftDown

classpath/java/util/Arrays.java:226–243  ·  view source on GitHub ↗
(T[] array, Comparator<? super T> comparator,
    int i, int count, int offset)

Source from the content-addressed store, hash-verified

224 }
225
226 private static <T> void siftDown(T[] array, Comparator<? super T> comparator,
227 int i, int count, int offset)
228 {
229 T value = array[offset + i];
230 while (i < count / 2) {
231 int child = 2 * i + 1;
232 if (child + 1 < count &&
233 comparator.compare(array[child], array[child + 1]) < 0) {
234 ++child;
235 }
236 if (comparator.compare(value, array[child]) >= 0) {
237 break;
238 }
239 array[offset + i] = array[offset + child];
240 i = child;
241 }
242 array[offset + i] = value;
243 }
244
245 private static <T> void insertionSort(T[] array,
246 Comparator<? super T> comparator)

Callers 1

heapSortMethod · 0.95

Calls 1

compareMethod · 0.65

Tested by

no test coverage detected