Operations on BSTs: Search
Here’s another function that does the same:
TreeSearch(x, k)
while (x != NULL and k != key[x])
if (k < key[x])
x = left[x];
else
x = right[x];
return x;
Which of these two functions is more efficient?
Previous slide
Next slide
Back to first slide
View graphic version