private void siftUp(int childIndex) { E target = elements[childIndex]; int parentIndex; while (childIndex > 0) { parentIndex = (childIndex - 1) / 2; E parent = elements[parentIndex]; if (compare(parent, target) <= 0) { break; } elements[childIndex] = parent; childIndex = parentIndex; } elements[childIndex] = target; }
private void siftDown(int rootIndex) { E target = elements[rootIndex]; int childIndex; while ((childIndex = rootIndex * 2 + 1) < size) { if (childIndex + 1 < size && compare(elements[childIndex + 1], elements[childIndex]) < 0) { childIndex++; } if (compare(target, elements[childIndex]) <= 0) { break; } elements[rootIndex] = elements[childIndex]; rootIndex = childIndex; } elements[rootIndex] = target; }
private void siftUp(int childIndex) { E target = elements[childIndex]; int parentIndex; while (childIndex > 0) { parentIndex = (childIndex - 1) / 2; E parent = elements[parentIndex]; if (compare(parent, target) <= 0) { break; } elements[childIndex] = parent; childIndex = parentIndex; } elements[childIndex] = target; }
private void siftUp(int childIndex) { E target = elements[childIndex]; int parentIndex; while (childIndex > 0) { parentIndex = (childIndex - 1) / 2; E parent = elements[parentIndex]; if (compare(parent, target) <= 0) { break; } elements[childIndex] = parent; childIndex = parentIndex; } elements[childIndex] = target; }
private void siftDown(int rootIndex) { E target = elements[rootIndex]; int childIndex; while ((childIndex = rootIndex * 2 + 1) < size) { if (childIndex + 1 < size && compare(elements[childIndex + 1], elements[childIndex]) < 0) { childIndex++; } if (compare(target, elements[childIndex]) <= 0) { break; } elements[rootIndex] = elements[childIndex]; rootIndex = childIndex; } elements[rootIndex] = target; }
private void siftUp(int childIndex) { E target = elements[childIndex]; int parentIndex; while (childIndex > 0) { parentIndex = (childIndex - 1) / 2; E parent = elements[parentIndex]; if (compare(parent, target) <= 0) { break; } elements[childIndex] = parent; childIndex = parentIndex; } elements[childIndex] = target; }
private void siftUp(int childIndex) { E target = elements[childIndex]; int parentIndex; while (childIndex > 0) { parentIndex = (childIndex - 1) / 2; E parent = elements[parentIndex]; if (compare(parent, target) <= 0) { break; } elements[childIndex] = parent; childIndex = parentIndex; } elements[childIndex] = target; }
private void siftUp(int childIndex) { E target = elements[childIndex]; int parentIndex; while (childIndex > 0) { parentIndex = (childIndex - 1) / 2; E parent = elements[parentIndex]; if (compare(parent, target) <= 0) { break; } elements[childIndex] = parent; childIndex = parentIndex; } elements[childIndex] = target; }
private void siftDown(int rootIndex) { E target = elements[rootIndex]; int childIndex; while ((childIndex = rootIndex * 2 + 1) < size) { if (childIndex + 1 < size && compare(elements[childIndex + 1], elements[childIndex]) < 0) { childIndex++; } if (compare(target, elements[childIndex]) <= 0) { break; } elements[rootIndex] = elements[childIndex]; rootIndex = childIndex; } elements[rootIndex] = target; }
private void siftUp(int childIndex) { E target = elements[childIndex]; int parentIndex; while (childIndex > 0) { parentIndex = (childIndex - 1) / 2; E parent = elements[parentIndex]; if (compare(parent, target) <= 0) { break; } elements[childIndex] = parent; childIndex = parentIndex; } elements[childIndex] = target; }
private void siftUp(int childIndex) { E target = elements[childIndex]; int parentIndex; while (childIndex > 0) { parentIndex = (childIndex - 1) / 2; E parent = elements[parentIndex]; if (compare(parent, target) <= 0) { break; } elements[childIndex] = parent; childIndex = parentIndex; } elements[childIndex] = target; }
private void siftDown(int rootIndex) { E target = elements[rootIndex]; int childIndex; while ((childIndex = rootIndex * 2 + 1) < size) { if (childIndex + 1 < size && compare(elements[childIndex + 1], elements[childIndex]) < 0) { childIndex++; } if (compare(target, elements[childIndex]) <= 0) { break; } elements[rootIndex] = elements[childIndex]; rootIndex = childIndex; } elements[rootIndex] = target; }
private void siftDown(int rootIndex) { E target = elements[rootIndex]; int childIndex; while ((childIndex = rootIndex * 2 + 1) < size) { if (childIndex + 1 < size && compare(elements[childIndex + 1], elements[childIndex]) < 0) { childIndex++; } if (compare(target, elements[childIndex]) <= 0) { break; } elements[rootIndex] = elements[childIndex]; rootIndex = childIndex; } elements[rootIndex] = target; }
private void siftDown(int rootIndex) { E target = elements[rootIndex]; int childIndex; while ((childIndex = rootIndex * 2 + 1) < size) { if (childIndex + 1 < size && compare(elements[childIndex + 1], elements[childIndex]) < 0) { childIndex++; } if (compare(target, elements[childIndex]) <= 0) { break; } elements[rootIndex] = elements[childIndex]; rootIndex = childIndex; } elements[rootIndex] = target; }
private void siftDown(int rootIndex) { E target = elements[rootIndex]; int childIndex; while ((childIndex = rootIndex * 2 + 1) < size) { if (childIndex + 1 < size && compare(elements[childIndex + 1], elements[childIndex]) < 0) { childIndex++; } if (compare(target, elements[childIndex]) <= 0) { break; } elements[rootIndex] = elements[childIndex]; rootIndex = childIndex; } elements[rootIndex] = target; }
private void siftDown(int rootIndex) { E target = elements[rootIndex]; int childIndex; while ((childIndex = rootIndex * 2 + 1) < size) { if (childIndex + 1 < size && compare(elements[childIndex + 1], elements[childIndex]) < 0) { childIndex++; } if (compare(target, elements[childIndex]) <= 0) { break; } elements[rootIndex] = elements[childIndex]; rootIndex = childIndex; } elements[rootIndex] = target; }