MCPcopy
hub / github.com/kunal-kushwaha/DSA-Bootcamp-Java / upheap

Method upheap

lectures/24-heaps/code/heaps-1/Heap.java:33–42  ·  view source on GitHub ↗
(int index)

Source from the content-addressed store, hash-verified

31 upheap(list.size() - 1);
32 }
33 private void upheap(int index) {
34 if(index == 0) {
35 return;
36 }
37 int p = parent(index);
38 if(list.get(index).compareTo(list.get(p)) < 0) {
39 swap(index, p);
40 upheap(p);
41 }
42 }
43
44 public T remove() throws Exception {
45 if (list.isEmpty()) {

Callers 1

insertMethod · 0.95

Calls 4

parentMethod · 0.95
swapMethod · 0.95
compareToMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected