com.futureshocked.datastructures
Class BinaryTree

java.lang.Object
  extended by 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.


Field Summary
private  BinaryNode root
          The root of the binary tree.
 
Constructor Summary
BinaryTree()
           
BinaryTree(BinaryNode root)
           
 
Method Summary
 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).
 void insert(BinaryNode node)
           
private  BinaryNode insert(BinaryNode curNode, BinaryNode newNode)
           
 void insert(int value)
           
static void main(java.lang.String[] args)
           
 void printTree()
           
private  void printTree(BinaryNode node, int depth)
           
private  BinaryNode search(BinaryNode curNode, int number)
           
 BinaryNode search(int number)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

root

private BinaryNode root
The root of the binary tree.

Constructor Detail

BinaryTree

public BinaryTree()

BinaryTree

public BinaryTree(BinaryNode root)
Method Detail

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)