|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.datastructures.LinkedBinaryTree<Entry<K,V>>
net.datastructures.BinarySearchTree<K,V>
public class BinarySearchTree<K,V>
Realization of a dictionary by means of a binary search tree.
| Constructor Summary | |
|---|---|
BinarySearchTree()
Creates a BinarySearchTree with a default comparator. |
|
BinarySearchTree(java.util.Comparator<K> cprtr)
Creates a BinarySearchTree with the given comparator. |
|
| Method Summary | |
|---|---|
java.lang.Iterable<Entry<K,V>> |
entries()
Returns an iterator containing all entries in the tree. |
Entry<K,V> |
find(K key)
Returns an entry containing the given key. |
java.lang.Iterable<Entry<K,V>> |
findAll(K key)
Returns an iterable collection of all the entries containing the given key. |
Entry<K,V> |
insert(K k,
V x)
Inserts an entry into the tree and returns the newly created entry. |
boolean |
isEmpty()
Returns whether the tree is empty. |
Entry<K,V> |
remove(Entry<K,V> ent)
Removes and returns a given entry. |
int |
size()
Returns the number of entries in the tree. |
| Methods inherited from class net.datastructures.LinkedBinaryTree |
|---|
addRoot, attach, children, expandExternal, hasLeft, hasRight, insertLeft, insertRight, isExternal, isInternal, isRoot, iterator, left, parent, positions, remove, removeAboveExternal, replace, right, root, sibling, swapElements |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BinarySearchTree()
public BinarySearchTree(java.util.Comparator<K> cprtr)
| Method Detail |
|---|
public int size()
size in interface Dictionary<K,V>size in interface Tree<Entry<K,V>>size in class LinkedBinaryTree<Entry<K,V>>public boolean isEmpty()
isEmpty in interface Dictionary<K,V>isEmpty in interface Tree<Entry<K,V>>isEmpty in class LinkedBinaryTree<Entry<K,V>>
public Entry<K,V> find(K key)
throws InvalidKeyException
find in interface Dictionary<K,V>InvalidKeyException
public java.lang.Iterable<Entry<K,V>> findAll(K key)
throws InvalidKeyException
findAll in interface Dictionary<K,V>InvalidKeyException
public Entry<K,V> insert(K k,
V x)
throws InvalidKeyException
insert in interface Dictionary<K,V>InvalidKeyException
public Entry<K,V> remove(Entry<K,V> ent)
throws InvalidEntryException
remove in interface Dictionary<K,V>InvalidEntryExceptionpublic java.lang.Iterable<Entry<K,V>> entries()
entries in interface Dictionary<K,V>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||