MCPcopy Create free account
hub / github.com/algorithmzuo/algorithm-journey / add

Method add

src/class027/Code02_MaxCover.java:73–80  ·  view source on GitHub ↗
(int x)

Source from the content-addressed store, hash-verified

71 public static int size;
72
73 public static void add(int x) {
74 heap[size] = x;
75 int i = size++;
76 while (heap[i] < heap[(i - 1) / 2]) {
77 swap(i, (i - 1) / 2);
78 i = (i - 1) / 2;
79 }
80 }
81
82 public static void pop() {
83 swap(0, --size);

Callers 15

computeMethod · 0.95
mainMethod · 0.45
mainMethod · 0.45
mainMethod · 0.45
preorderTraversalMethod · 0.45
inorderTraversalMethod · 0.45
bfsMethod · 0.45
dfsMethod · 0.45
minStickersMethod · 0.45

Calls 1

swapMethod · 0.95

Tested by

no test coverage detected