Class BSTnode

java.lang.Object
  extended by BSTnode

public class BSTnode
extends java.lang.Object

What a node in a Binary Search Tree looks like. In real life, BSTs can be used for implementing a table, where each key has some associated data with it.

Version:
5/20/11
Author:
Chris Fernandes

Field Summary
 KeyValueEntry entry
          Each node holds a key (which is used to enforce the BST property for all nodes) and some associated value which the BST doesn't need to know anything about.
 BSTnode llink
          left kid
 BSTnode rlink
          right kid
 
Constructor Summary
BSTnode(Comparable key, java.lang.Object newData)
          non-default constructor: key and data
 
Method Summary
 boolean isLeaf()
          returns true iff this node is a leaf node
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

entry

public KeyValueEntry entry
Each node holds a key (which is used to enforce the BST property for all nodes) and some associated value which the BST doesn't need to know anything about.


llink

public BSTnode llink
left kid


rlink

public BSTnode rlink
right kid

Constructor Detail

BSTnode

public BSTnode(Comparable key,
               java.lang.Object newData)
non-default constructor: key and data

Parameters:
key - key of this node
newData - associated data in this node
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
key-value pair as a string

isLeaf

public boolean isLeaf()
returns true iff this node is a leaf node

Returns:
True if node is a leaf and False otherwise