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

Function kth

code/data-structures/cartesian_tree.cpp:40–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38 else { node *old = t; t = merge(t->l, t->r); delete old; }
39 if (t) augment(t); return t; }
40int kth(node *t, int k) {
41 if (k < tsize(t->l)) return kth(t->l, k);
42 else if (k == tsize(t->l)) return t->x;
43 else return kth(t->r, k - tsize(t->l) - 1); }
44// vim: cc=60 ts=2 sts=2 sw=2:

Callers

nothing calls this directly

Calls 1

tsizeFunction · 0.85

Tested by

no test coverage detected