|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.directory.server.core.avltree.AvlTree<K>
public class AvlTree<K>
An AVL tree implementation
Constructor Summary | |
---|---|
AvlTree(java.util.Comparator<K> comparator)
Creates a new instance of AVLTree. |
Method Summary | |
---|---|
LinkedAvlNode<K> |
find(K key)
Find a LinkedAvlNode with the given key value in the tree. |
LinkedAvlNode<K> |
findGreater(K key)
Finds a LinkedAvlNode |
LinkedAvlNode<K> |
findGreaterOrEqual(K key)
Finds a LinkedAvlNode |
LinkedAvlNode<K> |
findLess(K key)
Finds a LinkedAvlNode |
LinkedAvlNode<K> |
findLessOrEqual(K key)
Finds a LinkedAvlNode |
java.util.Comparator<K> |
getComparator()
|
LinkedAvlNode<K> |
getFirst()
|
java.util.List<K> |
getKeys()
|
LinkedAvlNode<K> |
getLast()
|
LinkedAvlNode<K> |
getRoot()
|
int |
getSize()
returns the number of nodes present in this tree. |
K |
insert(K key)
Inserts a LinkedAvlNode with the given key. |
boolean |
isEmpty()
Tests if the tree is logically empty. |
void |
printTree()
Prints the contents of AVL tree in pretty format |
K |
remove(K key)
Removes the LinkedAvlNode present in the tree with the given key value |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AvlTree(java.util.Comparator<K> comparator)
comparator
- the comparator to be used for comparing keysMethod Detail |
---|
public java.util.Comparator<K> getComparator()
public K insert(K key)
key
- the item to be inserted
public K remove(K key)
key
- the value of the node to be removed
public boolean isEmpty()
public int getSize()
public LinkedAvlNode<K> getRoot()
public java.util.List<K> getKeys()
public void printTree()
public LinkedAvlNode<K> getFirst()
public LinkedAvlNode<K> getLast()
public LinkedAvlNode<K> findGreater(K key)
key
- the key
public LinkedAvlNode<K> findGreaterOrEqual(K key)
key
- the key
public LinkedAvlNode<K> findLess(K key)
key
- the key
public LinkedAvlNode<K> findLessOrEqual(K key)
key
- the key
public LinkedAvlNode<K> find(K key)
key
- the key to find
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |