In 21-25, use the steps of Algorithm 10.5.1 to build binary search trees. Use numerical order in 21 and alphabetical order in 22—25. In parts (a) and (b) of 21 and 22, the elements in the lists are the same, but the trees are different because the lists are ordered differently.
25. All good things which exist are the fruits of
The construction of the binary search tree.
Given information:
Keys for a binary search tree is given as,
All, good, things, which, exists, are, the, fruits, of, originality.
Calculation:
According to the algorithm given in
Before adding a new key search it’s correct position by going left if it is lesser than the current node else go right.
Once we are at the correct position add the key to its parent node.