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

Method swim

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

Source from the content-addressed store, hash-verified

11 inline void swp(int i, int j) {
12 SWP(q[i], q[j]), SWP(loc[q[i]], loc[q[j]]); }
13 void swim(int i) {
14 while (i > 0) {
15 int p = (i - 1) / 2;
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;

Callers

nothing calls this directly

Calls 1

cmpClass · 0.70

Tested by

no test coverage detected