Implementing a Binary Tree
Write a generic implementation of a binary tree class using an internal node class
TreeBinUMUC and NodeTreeBin
Input:
- Define a data file format to specify a binary tree
- Create some sample data files
Output:
- Walk the internal binary tree in inpre-order,post-orderandin-orderusing recursive algorithms.
Required Methods:
- TreeBinUMUC (Scanner)- create a tree from a Scanner tied to a file
- TreeBinUMUC ()- no-parameter constructor
- N findElement (String) - returns the node pointing to the element matching the String parameter - you will have to define the meaning of match in the context of the class T
- void insertLeftChild (N, T)
- void insertRightChild (N, T)
- N getRoot ()
- String toString ()
- String toPreOrderString ()
- String toPostOrderString ()
- String toInOrderString ()
- String NodeTreeBin.toPreOrderString ()
- String NodeTreeBin.toPostOrderString ()
- String NodeTreeBin.toInOrderString ()
- N NodeTreeBin.getLeftChild ()
- N NodeTreeBin.getRightChild ()