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

Method predecessor

code/data-structures/avl_tree.cpp:97–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95 while (p && p->r == n) n = p, p = p->p;
96 return p; }
97 node* predecessor(node *n) const {
98 if (!n) return NULL;
99 if (n->l) return nth(n->l->size-1, n->l);
100 node *p = n->p;
101 while (p && p->l == n) n = p, p = p->p;
102 return p; }
103 node* nth(int n, node *cur = NULL) const {
104 if (!cur) cur = root;
105 while (cur) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected