Programming Assignment for Trees

Due November 25, 2003

 

Problem 6, on page 494

 

In addition, write a main method in the iterator class to test the traversals.  The main method should:

 

Read a list of numbers from input (one per line).

Insert the numbers in a binary search tree, so that they are in numeric order.

Print the binary search tree, using 1) pre-order; 2) in-order; and 3) post-order.

 

On your output, please label the kind of traversal before you print the values, so I can determine whether your traversal is correct!