public void sort(final IndexedSortable s, final int p, final int r) { final int N = r - p; // build heap w/ reverse comparator, then write in-place from end final int t = Integer.highestOneBit(N); for (int i = t; i > 1; i >>>= 1) { for (int j = i >>> 1; j < i; ++j) { downHeap(s, p - 1, j, N + 1); } } for (int i = r - 1; i > p; --i) { s.swap(p, i); downHeap(s, p - 1, 1, i - p + 1); } }
@Override public void sort(IndexedSortable s) { sort(s, 0, s.size()); } }
@Override public void sort(IndexedSortable s) { sort(s, 0, s.size()); } }
@Override public void sort(IndexedSortable s) { sort(s, 0, s.size()); } }
public void sort(final IndexedSortable s, final int p, final int r) { final int N = r - p; // build heap w/ reverse comparator, then write in-place from end final int t = Integer.highestOneBit(N); for (int i = t; i > 1; i >>>= 1) { for (int j = i >>> 1; j < i; ++j) { downHeap(s, p - 1, j, N + 1); } } for (int i = r - 1; i > p; --i) { s.swap(p, i); downHeap(s, p - 1, 1, i - p + 1); } }
@Override public void sort(IndexedSortable s) { sort(s, 0, s.size()); } }
public void sort(final IndexedSortable s, final int p, final int r) { final int N = r - p; // build heap w/ reverse comparator, then write in-place from end final int t = Integer.highestOneBit(N); for (int i = t; i > 1; i >>>= 1) { for (int j = i >>> 1; j < i; ++j) { downHeap(s, p - 1, j, N + 1); } } for (int i = r - 1; i > p; --i) { s.swap(p, i); downHeap(s, p - 1, 1, i - p + 1); } }
public void sort(final IndexedSortable s, final int p, final int r) { final int N = r - p; // build heap w/ reverse comparator, then write in-place from end final int t = Integer.highestOneBit(N); for (int i = t; i > 1; i >>>= 1) { for (int j = i >>> 1; j < i; ++j) { downHeap(s, p - 1, j, N + 1); } } for (int i = r - 1; i > p; --i) { s.swap(p, i); downHeap(s, p - 1, 1, i - p + 1); } }