com.futureshocked.datastructures
Class BinaryTree
java.lang.Object
com.futureshocked.datastructures.BinaryTree
public class BinaryTree
- extends java.lang.Object
Simple implementation of a binary tree - to be used for testing out the
DebuggerClassLoader.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
root
private BinaryNode root
- The root of the binary tree.
BinaryTree
public BinaryTree()
BinaryTree
public BinaryTree(BinaryNode root)
getRoot
public BinaryNode getRoot()
- Ordinarily this method shouldn't exist for a binary tree, but this allows
us to create a loop in the binary tree by setting a leave's child to
the root of the tree (to test out the recursion limiter).
- Returns:
- A
BinaryNode
object that is the root of the tree.
insert
public void insert(int value)
insert
public void insert(BinaryNode node)
insert
private BinaryNode insert(BinaryNode curNode,
BinaryNode newNode)
search
public BinaryNode search(int number)
search
private BinaryNode search(BinaryNode curNode,
int number)
printTree
public void printTree()
printTree
private void printTree(BinaryNode node,
int depth)
main
public static void main(java.lang.String[] args)