All Packages Class Hierarchy This Package Previous Next Index
Class DataStructures.BinarySearchTreeWithRank
java.lang.Object
|
+----DataStructures.BinarySearchTree
|
+----DataStructures.BinarySearchTreeWithRank
- public class BinarySearchTreeWithRank
- extends DataStructures.BinarySearchTree
Implements a binary search tree with a findKth method.
Note that all "matching" is based on the compares method.
-
BinarySearchTreeWithRank()
-
-
findKth(int)
- Find the kth smallest item in the tree.
-
main(String[])
-
BinarySearchTreeWithRank
public BinarySearchTreeWithRank()
findKth
public Supporting.Comparable findKth(int k) throws Exceptions.ItemNotFound
- Find the kth smallest item in the tree.
- Parameters:
- k - the desired rank (1 is the smallest item).
- Returns:
- the kth smallest item in the tree.
- Throws: ItemNotFound
- if k is less
than 1 or more than the size of the tree.
main
public static void main(java.lang.String args[])
All Packages Class Hierarchy This Package Previous Next Index