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

Method remove

lectures/27-huffman-coding/code/Heap.java:32–46  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30 }
31
32 public T remove() throws Exception{
33 if(list.isEmpty()){
34 throw new Exception("Removing from empty Heap");
35 }
36 T temp = list.get(0);
37
38 T last = list.remove(list.size() - 1);
39
40 if(!list.isEmpty()){
41 list.set(0, last);
42
43 downheap(0);
44 }
45 return temp;
46 }
47
48 private void downheap(int index) {
49

Callers 2

heapSortMethod · 0.95
HuffmanCoderMethod · 0.95

Calls 5

downheapMethod · 0.95
isEmptyMethod · 0.45
getMethod · 0.45
sizeMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected