|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface SearchTree<T extends java.lang.Comparable<? super T>>
Interface for the Search Tree ADT.
Method Summary | |
---|---|
void |
add(T item)
Adds the given item to the tree. |
void |
clear()
Removes all items from the tree. |
boolean |
contains(T item)
Checks whether the given item is in the tree. |
int |
height()
Returns the height of the tree. |
List<T> |
inOrderTraversal()
Returns a list of all the items in this search tree in order. |
boolean |
isEmpty()
Returns whether the tree is empty. |
java.util.Iterator<T> |
iterator()
Returns an iterator over the in-order traversal of the tree. |
List<T> |
postOrderTraversal()
Returns a List of all the items in the tree, ordered as in a prost-order traversal. |
List<T> |
preOrderTraversal()
Returns a List of all the items in the tree, ordered as in a pre-order traversal. |
void |
remove(T item)
Removes the given item from the tree. |
int |
size()
Returns the number of items in the tree. |
Method Detail |
---|
boolean contains(T item)
item
- The item to look for.
void add(T item)
item
- The item to add.void remove(T item)
item
- The item to add.int height()
int size()
void clear()
boolean isEmpty()
List<T> inOrderTraversal()
java.util.Iterator<T> iterator()
iterator
in interface java.lang.Iterable<T extends java.lang.Comparable<? super T>>
List<T> preOrderTraversal()
List<T> postOrderTraversal()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |