12.4 | Data Structures and Algorithms Using C++
In the BST shown in Figure 12.3, to search for the key 13, it is initially compared with the root 15 as 13 is
less than 15 consider only the le subtree of node 15. Now, the root of the le subtree 10 is compared with the
key 13 and as 13 is greater than 10, consider its right subtree. Proceed to the root of the right subtree 13 and it
is compared with the key 13, as they are equal the search is successful.
Similarly to search for a key 28, it is compared with the root 15 as 28 is greater than 15 consider the right
subtree to continue the search. Now, the root of the right subtree 25 is compared with 28 and as 28 is greater
than 25 consider the right subtree of 25. Now, the root of the righ ...