|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--BinaryTreePlusNode
Class BinaryTreePlusNode is an extension of the plain BinaryTreeNode class. BinaryTreePlusNode adds a height field and some other potentially useful fields for use in AVL trees.
Field Summary | |
protected int |
height
Height of subtree rooted at this node |
protected BinaryTreePlusNode |
left
Pointer to the left subtree of this node |
protected BinaryTreePlusNode |
parent
Parent node |
protected int |
position
Ordinal position of the value this node |
protected BinaryTreePlusNode |
right
Pointer to the right subtree of this node |
protected int |
size
Size of subtree rooted at this node |
protected java.lang.Object |
value
The data value of this node |
Constructor Summary | |
BinaryTreePlusNode(java.lang.Object value,
BinaryTreePlusNode left,
BinaryTreePlusNode right)
Construct a node with the given value and subtree pointers. |
Method Summary | |
boolean |
isLeaf()
Return tree if this is a leaf node, i.e., both right and left pointers are null. |
protected boolean |
onlyLeftChild()
Return true if this node is an only left child. |
protected boolean |
onlyRightChild()
Return true if this node is an only left child. |
java.lang.String |
toString()
Convert this to a preorder string of the same form as BinarySearchTree.toString. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.lang.Object value
protected BinaryTreePlusNode left
protected BinaryTreePlusNode right
protected int height
protected int size
protected int position
protected BinaryTreePlusNode parent
Constructor Detail |
public BinaryTreePlusNode(java.lang.Object value, BinaryTreePlusNode left, BinaryTreePlusNode right)
Method Detail |
public boolean isLeaf()
public java.lang.String toString()
toString
in class java.lang.Object
protected boolean onlyLeftChild()
protected boolean onlyRightChild()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |