|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectBinarySearchTree<E>
public class BinarySearchTree<E extends Comparable<? super E>>
Shell for a bianry search tree class.
| Constructor Summary | |
|---|---|
BinarySearchTree()
|
|
| Method Summary | |
|---|---|
boolean |
add(E data)
add the specified item to this Binary Search Tree if it is not already present. |
List<E> |
getAll()
return a list of all the elements in this Binary Search Tree. |
int |
height()
return the height of this Binary Search Tree. |
boolean |
isPresent(E data)
check to see if the specified element is in this Binary Search Tree. |
boolean |
iterativeAdd(E data)
An add method that implements the add algorithm iteratively instead of recursively. |
E |
max()
return the maximum value in this binary search tree. |
E |
min()
return the minimum value in this binary search tree. |
int |
numNodesAtDepth(int d)
Find the number of nodes in this tree at the specified depth. |
void |
printTree()
Prints a vertical representation of this tree. |
boolean |
remove(E data)
remove a specified item from this Binaray Search Tree if it is present. |
int |
size()
return how many elements are in this Binary Search Tree. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BinarySearchTree()
| Method Detail |
|---|
public boolean add(E data)
data - the data to add to the tree
public boolean remove(E data)
data - the data to remove from the tree if present
public boolean isPresent(E data)
data - the data to look for in the treepublic int size()
public int height()
public List<E> getAll()
public E max()
public E min()
public boolean iterativeAdd(E data)
data - the item to be added to this tree
public int numNodesAtDepth(int d)
d - The depth to find nodes at.
public void printTree()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||