next up previous
Next: About this document ... Up: lab09 Previous: High/Low Number Guessing

tree Traversal

This program should invoke a recursive method that calculates the number of leaves and the number of nodes in a binary tree, using BTNode. It should do this by returning an int array containg the leaves in position[0] and the nodes in position 1. You will remember that ``listCopy'' returned a pair of references to the head and tail of a copied list. (see Programming Tip page 201)

In your test program CountNodes.java you should build a ``search'' tree that contains strings: Mary, Bill, Sam, April, Charlie, Tom, Harry, Sue.

References:



Manton Matthews 2002-07-02