JavaAlgorithms
Elementary and no so elementary Java algorithms
treeAlgorithms.TreeBuilder< T extends Comparable< T > > Class Reference

List of all members.

Public Member Functions

 TreeBuilder ()
 TreeBuilder (TreeNode< T > root)
 TreeBuilder (T[] vals)
boolean addNode (T newVal)
TreeNode< T > getTree ()

Protected Member Functions

boolean addNode (TreeNode< T > root, T newVal)

Detailed Description

TreeBuilder

Build an ordered binary tree, where the left branch is the "less than" branch and the right branch is the greater than branch. Jun 15, 2013

Author:
Ian Kaplan, iank@bearcave.com
Parameters:
<T>

Definition at line 22 of file TreeBuilder.java.


Constructor & Destructor Documentation

treeAlgorithms.TreeBuilder< T extends Comparable< T > >.TreeBuilder ( )

The constructor to build an empty tree

Definition at line 28 of file TreeBuilder.java.

treeAlgorithms.TreeBuilder< T extends Comparable< T > >.TreeBuilder ( TreeNode< T >  root)

The constructor to add to an existing tree (even if the tree consists of a single root node).

Parameters:
rootthe root of the tree.

Definition at line 38 of file TreeBuilder.java.

treeAlgorithms.TreeBuilder< T extends Comparable< T > >.TreeBuilder ( T[]  vals)

Definition at line 42 of file TreeBuilder.java.


Member Function Documentation

boolean treeAlgorithms.TreeBuilder< T extends Comparable< T > >.addNode ( TreeNode< T >  root,
newVal 
) [protected]

The internal function to add a new value to the tree.

Parameters:
rootthe root of the tree or sub-tree
newValthe new value to be added to the tree
Returns:
true if the value is found in the tree, false otherwise

Definition at line 59 of file TreeBuilder.java.

boolean treeAlgorithms.TreeBuilder< T extends Comparable< T > >.addNode ( newVal)

Add a new value to the tree

Parameters:
newVal
Returns:
true if the value is found in the tree, false otherwise.

Definition at line 88 of file TreeBuilder.java.

TreeNode<T> treeAlgorithms.TreeBuilder< T extends Comparable< T > >.getTree ( )
Returns:
the root of the tree

Definition at line 104 of file TreeBuilder.java.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables