public class BinarySearchTree extends BasicTree
Constructor and Description |
---|
BinarySearchTree()
Base constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
InsertLeaf(ExplicitTreeNode currentNode,
ExplicitTreeNode parentNode,
ExplicitTreeNode newNode,
boolean leftChild)
Inserts given node as new tree leaf.
|
void |
InsertNode(ExplicitTreeNode newNode)
Attempts to insert provided node at root.
|
ExplicitTreeNode |
SearchForMatch(ExplicitTreeNode node,
java.lang.String firstName,
java.lang.String lastName)
Iterates through search tree to look for name match.
|
CreateNode, GetSubtreeCount, PrintTreeInOrder, PrintTreePostOrder, PrintTreePreOrder, TreeRoot, TreeRoot
public void InsertNode(ExplicitTreeNode newNode)
newNode
- Node to insert.public ExplicitTreeNode SearchForMatch(ExplicitTreeNode node, java.lang.String firstName, java.lang.String lastName)
node
- Root node.firstName
- First name to match.lastName
- Last name to match.protected void InsertLeaf(ExplicitTreeNode currentNode, ExplicitTreeNode parentNode, ExplicitTreeNode newNode, boolean leftChild)
currentNode
- Current node of subtree.parentNode
- Parent of current node.newNode
- Node leaf to insert.leftChild
- Bool to hold if left or right child of parent.