public class Tree
extends java.lang.Object
Constructor and Description |
---|
Tree()
Creates a new Tree object and initializes a State_Controller object with
a size of 15.
|
Modifier and Type | Method and Description |
---|---|
void |
buildTree()
Builds a binary search tree from the array of State objects in a
State_Controller object.
|
void |
delete(java.lang.String key)
Deletes a node from the tree and then rebuilds the tree.
|
void |
iterativeScan(java.lang.String type)
Traverses the tree and displays its contents using pre-order, in-order,
and poat-order scans by using iterative methods.
|
void |
loadArray()
Builds an array of State objects through the use of a State_Controller
object, which will be used to build the tree.
|
void |
recursiveScan(java.lang.String type)
Traverses the tree and displays its contents using pre-order, in-order,
and post-order scans using recursive methods.
|
public Tree()
public void loadArray() throws java.io.IOException
java.io.IOException
- for invalid I/Opublic void buildTree()
public void iterativeScan(java.lang.String type)
type
- to define which scan you would like to usepublic void recursiveScan(java.lang.String type)
type
- to define which scan you would like to usepublic void delete(java.lang.String key)
key
- the node that will be deleted