MCPcopy Create free account
hub / github.com/SuprDewd/CompetitiveProgramming / sink

Method sink

code/data-structures/heap.cpp:18–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16 if (!cmp(i, p)) break;
17 swp(i, p), i = p; } }
18 void sink(int i) {
19 while (true) {
20 int l = 2*i + 1, r = l + 1;
21 if (l >= count) break;
22 int m = r >= count || cmp(l, r) ? l : r;
23 if (!cmp(m, i)) break;
24 swp(m, i), i = m; } }
25 heap(int init_len = 128)
26 : count(0), len(init_len), _cmp(Compare()) {
27 q = new int[len], loc = new int[len];

Callers

nothing calls this directly

Calls 1

cmpClass · 0.70

Tested by

no test coverage detected