Summary: Program 2 Page 1
CS 2420 Fall 2010
Program 2 20 points
Due September 20, 2010
More Fun With Recursion
Objective: More fun with recursion. Check the provided starter code to make sure
you have the correct prototypes. Feel free to modify prototypes if something else is
In the comments to each function, provide a big-Oh expression for the complexity
of the functions you write, assuming trees are roughly balanced (depth = log(n) for
n nodes). Use recursion where appropriate, but if something isn't logically
recursive, don't use recursion.
1. Write functions that return the minimum and maximum nodes in a binary search tree
rooted at root. Assume trees store unique elements (no duplicates).
2. Write a function to find the inorder successor of a node. You should use the parent link
This function can be written in fewer than 10 lines of code that's a guideline, not a
3. Write the function levelCount that returns the total number of nodes on the specified
level. For this problem, the root is at level zero, the root's children are at level one, and
for any node, the node's level is one more than its parent's level.