Interface BSTInterface

All Superinterfaces:
Serializable
All Known Implementing Classes:
AATree, AVLTree, BinarySearchTree, PatriciaTrie, RedBlackTree, SplayTree, Trie

public interface BSTInterface extends Serializable
This interface is implemented by each of the data structures whose functionality is equivalent to a binary search tree. Functionality includes the ability to insert and delete String keys, to clone itself, and to draw itself.

Note that this interface does not extend java.lang.Cloneable. This is because implementations may not need to use the clone method of Object in order to clone themselves.

Author:
Rod Howell (rhowell@ksu.edu)
See Also:
  • Method Details

    • put

      Returns the result of inserting key into this tree. If key is already in the tree, a tree having the same contents is returned.
      Parameters:
      key - the key to insert
      Returns:
      the resutling tree
      Throws:
      NullPointerException - If key is null
    • remove

      Returns the result of removing key from this. If key is not in the tree, a tree having the same contents is returned.
      Parameters:
      key - the key to remove
      Returns:
      the resulting tree
      Throws:
      NullPointerException - If key is null
    • getDrawing

      JComponent getDrawing()
      Returns a drawing of the tree.
      Returns:
      a drawing of the tree
    • getDrawing

      JComponent getDrawing(Font fnt)
      Returns a drawing of the tree using the given Font.
      Parameters:
      fnt - the font to use
      Returns:
      a drawing of the tree
      Throws:
      NullPointerException - if fnt is null.
    • clone

      Object clone()
      Returns a clone of this tree.
      Returns:
      a clone of the this tree