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

Method successor

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

Source from the content-addressed store, hash-verified

89 fix(n->p), n->p = n->l = n->r = NULL;
90 if (free) delete n; }
91 node* successor(node *n) const {
92 if (!n) return NULL;
93 if (n->r) return nth(0, n->r);
94 node *p = n->p;
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);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected