Predecessor
Find the next smaller node
in this node’s subtree.
Node * pred(Node * root) {
if (root->left == NULL)
return NULL;
else
return max(root->left);
}
20
9
2
15
5
10
30
7
17
Previous slide
Next slide
Back to first slide
View graphic version