public abstract class BasicTree
extends java.lang.Object
Constructor and Description |
---|
BasicTree()
Base constructor.
|
Modifier and Type | Method and Description |
---|---|
ExplicitTreeNode |
CreateNode(java.lang.String firstName,
java.lang.String lastName)
Creates a node that holds the given name values.
|
protected int |
GetSubtreeCount(ExplicitTreeNode subTree)
Gets number of nodes in provided subtree.
|
void |
PrintTreeInOrder(ExplicitTreeNode node)
Uses in-order traversal to print all values within tree.
|
void |
PrintTreePostOrder(ExplicitTreeNode node)
Uses post-order traversal to print all values within tree.
|
void |
PrintTreePreOrder(ExplicitTreeNode node)
Uses pre-order traversal to print all values within tree.
|
ExplicitTreeNode |
TreeRoot()
Getter for tree root node.
|
void |
TreeRoot(ExplicitTreeNode treeRoot)
Setter for tree root node.
|
public ExplicitTreeNode TreeRoot()
public void TreeRoot(ExplicitTreeNode treeRoot)
treeRoot
- Node to be tree's root.public ExplicitTreeNode CreateNode(java.lang.String firstName, java.lang.String lastName)
firstName
- First name to store.lastName
- Last name to store.public void PrintTreePreOrder(ExplicitTreeNode node)
node
- Root node of tree.public void PrintTreeInOrder(ExplicitTreeNode node)
node
- Root node of tree.public void PrintTreePostOrder(ExplicitTreeNode node)
node
- Root node of tree.protected int GetSubtreeCount(ExplicitTreeNode subTree)
subTree
- Topmost node of given subtree.