|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectstructure.AbstractStructure
structure.BinarySearchTree
public class BinarySearchTree
A binary search tree structure. This structure maintains data in an ordered tree. It does not keep the tree balanced, so performance may degrade if the tree height is not optimal.
SplayTree,
BinaryTree| Constructor Summary | |
|---|---|
BinarySearchTree()
Constructs a binary search tree with no data |
|
BinarySearchTree(Comparator alternateOrder)
Constructs a binary search tree with no data |
|
| Method Summary | |
|---|---|
void |
add(Object value)
Add a (possibly duplicate) value to binary search tree |
void |
clear()
Removes all data from the binary search tree |
boolean |
contains(Object value)
Determines if the binary search tree contains a value |
Object |
get(Object value)
Returns reference to value found within three. |
boolean |
isEmpty()
Checks for an empty binary search tree |
Iterator |
iterator()
Returns an iterator over the binary search tree. |
Object |
remove(Object value)
Remove an value "equals to" the indicated value. |
int |
size()
Determines the number of data values within the tree |
String |
toString()
Returns a string representing tree |
| Methods inherited from class structure.AbstractStructure |
|---|
elements, hashCode, values |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface structure.Structure |
|---|
elements, values |
| Constructor Detail |
|---|
public BinarySearchTree()
public BinarySearchTree(Comparator alternateOrder)
| Method Detail |
|---|
public boolean isEmpty()
isEmpty in interface StructureisEmpty in class AbstractStructurepublic void clear()
clear in interface Structurepublic int size()
size in interface Structurepublic void add(Object value)
add in interface Structureval - A reference to non-null objectpublic boolean contains(Object value)
contains in interface Structurecontains in class AbstractStructureval - The value sought. Should be non-null
public Object get(Object value)
val - Value sought from within tree
public Object remove(Object value)
remove in interface Structureval - Value sought to be removed from tree
public Iterator iterator()
iterator in interface StructureAbstractIterator,
Iterator,
Enumeration,
Structure.elements()public String toString()
toString in class Object
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||