Question: 22. Write a recursive function member 1eve10 for class template BST that determines the level in the BST at which a specified item is located.

22. Write a recursive function member 1eve10 for class template BST that determines the level in the BST at which a specified item is located. The root of the BST is at level 0, its children are at levell, and so on.

24. The worst-case number of comparisons in searching a BST is equal to its height, that is, the number oflevels in the tree.Write a recursive function member hei ght 0 for class template BST to determine the height of the BST.

25. Write a recursive function member 1eafCountO for class template BST to count the leaves in a binary tree. (Hint: How is the number of leaves in the entire tree related to the number of leaves in the left and right subtrees of the root?)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!