Write a recursive algorithm to count the number of right children in a binary search tree.
Write the method levelCount whose header is given below. Method levelCount returns the number of nodes on the specified level.
int BinarySearchTree :: levelCount(BinaryNode* t, int level);
For this problem, the root is at level zero, the root's children are at level one, and for any node N its level is one more than N's parent's level. For example, for the bean-tree diagrammed below, the call levelCount(t,1) should return 2 (chickpea and navy are on level 1); the call levelCount(t,2) should return 3; and the call levelCount(t,4) should return 0.
Hint: when the level is 0, there is always just one node at that level, the root node (assuming it isn't empty), so return 1. If the level isn't zero, recursive calls will be used to determine the number of nodes at the requested level, and the level-requested should change in the recursive calls.