public class BinarySearchTree<E extends java.lang.Comparable<? super E>>
extends java.lang.Object
Constructor and Description |
---|
BinarySearchTree()
Construct the tree.
|
Modifier and Type | Method and Description |
---|---|
E |
find(E val)
Find an item in the tree.
|
E |
findMaxItem()
Find the val of the largest item in the tree.
|
E |
findMinItem()
Find the smallest item in the tree.
|
void |
insert(E val)
Insert into the tree.
|
boolean |
isEmpty()
Test if the tree is logically empty.
|
static void |
main(java.lang.String[] args) |
void |
makeEmpty()
Make the tree logically empty.
|
void |
remove(E val)
Remove from the tree..
|
void |
removeMinItem()
Remove minimum item from the tree.
|
public void insert(E val)
val
- the item to insert.public void remove(E val)
val
- the item to remove.public void removeMinItem()
public E findMinItem()
public E findMaxItem()
public E find(E val)
val
- the item to search for.public void makeEmpty()
public boolean isEmpty()
public static void main(java.lang.String[] args)