|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--bst
Constructor Summary | |
bst()
Constructs a new binary search tree object, initializing the tree to be empty |
Method Summary | |
void |
addNode(int data)
Adds a node containing the given number to the tree, keeping the tree ordered as a BST |
boolean |
contains(int value)
Returns whether or not the tree contains a given value. |
boolean |
deleteNode(int data)
Removes the node containing the given data item from the tree. |
void |
inOrder()
Prints out the items in the tree using an in-order traversal |
void |
levelOrder()
Prints out the items in the tree using a level-order traversal |
void |
postOrder()
Prints out the items in the tree using a post-order traversal |
void |
preOrder()
Prints out the items in the tree using a pre-order traversal |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public bst()
Method Detail |
public void addNode(int data)
data
- The number to be placed in the treepublic boolean contains(int value)
value
- The value to look for in the tree.public boolean deleteNode(int data)
data
- The number to be removed from the treepublic void inOrder()
public void postOrder()
public void preOrder()
public void levelOrder()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |