Iterative Find
Node * find(Comparable key,
Node * root) {
while (root != NULL &&
root->key != key) {
if (key < root->key)
root = root->left;
else
root = root->right;
}
return root;
}
Look familiar?
20
9
2
15
5
10
30
7
17
Previous slide
Next slide
Back to first slide
View graphic version