com.pow2.structures.tree
Class BinarySearchTree

java.lang.Object
  extended bycom.pow2.structures.tree.BinaryTree
      extended bycom.pow2.structures.tree.BinarySearchTree

public class BinarySearchTree
extends BinaryTree

Binary search tree class.
Traverse this tree using post-order algorithm.

Author:
particle@theparticle.com (http://www.theparticle.com/)

Field Summary
 
Fields inherited from class com.pow2.structures.tree.BinaryTree
cat, INTRAVERSE, nodeVisitor, POSTRAVERSE, PRETRAVERSE, root, traverseMode
 
Constructor Summary
BinarySearchTree()
          Constructor for the BinarySearchTree object
BinarySearchTree(Object o)
          Constructor for the BinarySearchTree object
 
Method Summary
 void build()
          Build the tree
 void insert(Comparable o)
          Insert a Comparable object into the tree.
 void visit(Node n)
          Visit the content of the input node.
 
Methods inherited from class com.pow2.structures.tree.BinaryTree
addLeft, addRight, getData, getLeft, getNodeVisitor, getRight, getRoot, getTraverseMode, insertLeft, insertRight, intrav, isEmpty, move, postrav, pretrav, remove, remove, setData, setNodeVisitor, setRoot, setTraverseMode, traverse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinarySearchTree

public BinarySearchTree()
Constructor for the BinarySearchTree object


BinarySearchTree

public BinarySearchTree(Object o)
Constructor for the BinarySearchTree object

Parameters:
o - the root node of the tree.
Method Detail

insert

public void insert(Comparable o)
Insert a Comparable object into the tree.

Parameters:
o - the Comparable object to insert.

visit

public void visit(Node n)
Visit the content of the input node.

Overrides:
visit in class BinaryTree
Parameters:
n - the node to visit

build

public void build()
Build the tree

Specified by:
build in class BinaryTree


Copyright © 2002-2004 Power Of Two S.R.L. All Rights Reserved.