|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectintroExam.BinarySearchTree.BST
A minimal BST
class using a nested
BSTNode
class, for the 15-111/200
Final Exam/Fall 2004
Students are not permitted to modify or augment this class in any way. This file must not change.
Note that all instance variables declared in the
nested BSTNode
class are public
and that value
is also declared with
the final
access modifier.
Thus, the information that they store can be accessed
through these names directly, or through the provided
getters/setters (except value
cannot be
changed once it has been initialized, and it has no
setter).
Nested Class Summary | |
protected class |
BST.BSTNode
|
Field Summary | |
protected BST.BSTNode |
root
|
Constructor Summary | |
BST()
The default constructor: creates an empty binary search tree |
Method Summary | |
private BST.BSTNode |
insert(BST.BSTNode root,
java.lang.Comparable value)
This is a helper method -- no further description available |
void |
insert(java.lang.Comparable data)
Inserts a value into the proper position of a binary search tree. |
private java.lang.String |
niceTreeString(BST.BSTNode t,
java.lang.String indent)
This is a helper method -- no further description available |
java.lang.String |
toString()
Provides a nice string represention of a BST. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected BST.BSTNode root
Constructor Detail |
public BST()
Method Detail |
public void insert(java.lang.Comparable data)
private BST.BSTNode insert(BST.BSTNode root, java.lang.Comparable value)
private java.lang.String niceTreeString(BST.BSTNode t, java.lang.String indent)
public java.lang.String toString()
Students should not concern themselves with how it works -- an understanding of this is not important to this exam.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |