|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectscranton.Linear1
scranton.tree.RecursiveBinaryTreeViaLinear1
scranton.tree.BinarySearchTree
Implements a binary search tree by extending RecursiveBinaryTreeViaLinear1.
| Field Summary | |
(package private) java.util.Comparator |
c
The comparator that orders the binary search tree |
| Fields inherited from class scranton.Linear1 |
data, link |
| Constructor Summary | |
BinarySearchTree(java.util.Comparator c)
Constructs an empty binary search tree |
|
BinarySearchTree(java.lang.Object root,
BinarySearchTree left,
BinarySearchTree right,
java.util.Comparator c)
Constructs a non-empty binary search tree |
|
| Method Summary | |
void |
clockwiseRotate()
Perform a clockwise rotation around "this". |
void |
counterClockwiseRotate()
Perform a counterClockwise rotation around "this". |
Linear1 |
factory()
Returns an empty binary search tree |
void |
graft(BinarySearchTree O)
Graft the tree O to the current tree satisfying the search tree order given by the tree's comparator. |
void |
insert(java.lang.Object O)
Accept an object for insertion in the binary search tree, embed it in a tree and call the graft process to insert it. |
void |
lrPromote()
Performs a ccounterClockwise rotation around the left subchild of "this" before performing a clockwise rotation around "this". |
void |
rlPromote()
Performs a clockwise rotation around the right subchild of "this" before performing a counterClockwise rotation around "this". |
| Methods inherited from class scranton.tree.RecursiveBinaryTreeViaLinear1 |
getRoot, graft, isEmpty, leftSubtree, prune, rightSubtree, setRoot, sideways, toString |
| Methods inherited from class scranton.Linear1 |
getData, getLink, setData, setLink |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
java.util.Comparator c
| Constructor Detail |
public BinarySearchTree(java.util.Comparator c)
c - The ordering comparator
public BinarySearchTree(java.lang.Object root,
BinarySearchTree left,
BinarySearchTree right,
java.util.Comparator c)
c - The ordering comparator| Method Detail |
public void insert(java.lang.Object O)
O - The object to be embedded into the root of a tree and inserted into the binary search treepublic void graft(BinarySearchTree O)
O - The tree to be inserted.public Linear1 factory()
factory in class RecursiveBinaryTreeViaLinear1public void clockwiseRotate()
public void counterClockwiseRotate()
public void lrPromote()
public void rlPromote()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||