The following code attempts to find a value in a BST, and th…
The following code attempts to find a value in a BST, and then returns the depth at which the value is found. That is, if the value is in the root node, it will return 0; if the value is in one of the two children of the root, then it will return 1. Similarly, if the node is four steps away from the root, it will return 4. If the value is not in the tree, it returns -1. In the code below, fill in the blanks with all missing pieces of code. All blanks will require at least something; some may require a few symbols. What code belongs in the first blank? _______ What code belongs in the second blank? _______ What code belongs in the third blank? _______ What code belongs in the fourth blank? _______ What code belongs in the fifth blank? _______
Read Details