dataStructures
Class BinarySearchTree

java.lang.Object
  |
  +--dataStructures.LinkedBinaryTree
        |
        +--dataStructures.BinarySearchTree
Direct Known Subclasses:
BinarySearchTreeWithVisit, DBinarySearchTree

public class BinarySearchTree
extends LinkedBinaryTree
implements BSTree


Constructor Summary
BinarySearchTree()
           
 
Method Summary
 void ascend()
          output elements in ascending order of key
 java.lang.Object get(java.lang.Object theKey)
           
static void main(java.lang.String[] args)
           
 java.lang.Object put(java.lang.Object theKey, java.lang.Object theElement)
          insert an element with the specified key overwrite old element if there is already an element with the given key
 java.lang.Object remove(java.lang.Object theKey)
           
 
Methods inherited from class dataStructures.LinkedBinaryTree
add1, height, inOrder, inOrderOutput, isEmpty, levelOrder, levelOrderOutput, makeTree, output, postOrder, postOrderOutput, preOrder, preOrderOutput, removeLeftSubtree, removeRightSubtree, root, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinarySearchTree

public BinarySearchTree()
Method Detail

get

public java.lang.Object get(java.lang.Object theKey)
Returns:
element with specified key

put

public java.lang.Object put(java.lang.Object theKey,
                            java.lang.Object theElement)
insert an element with the specified key overwrite old element if there is already an element with the given key
Returns:
old element (if any) with key theKey

remove

public java.lang.Object remove(java.lang.Object theKey)
Returns:
matching element and remove it

ascend

public void ascend()
output elements in ascending order of key
Specified by:
ascend in interface BSTree

main

public static void main(java.lang.String[] args)