Describe how to find an element in a binary search tree. You may use English sentences or pseudocode.
What will be an ideal response?
Let x be the element that is being searched for. The algorithm begins by checking to see if the root is equal to
x. If it is, it halts, returning a reference to the element at the root. Otherwise it compares x to the root. If the root is not a leaf
and x is larger, then it recursively calls the method on the right subtree, and if it is smaller, it recursively calls the method on the
left subtree. If the node is a leaf, it returns null, meaning that the item is not found.
You might also like to view...
Briefly, what information does the ––help option display for the tar utility? How would you display this information one screen at a time?
What will be an ideal response?
What did the chief benefit of the early Internet prove to be?
What will be an ideal response?