public class Node
extends java.lang.Object
Node for a binary search
Tree.| Constructor and Description |
|---|
Node()
Empty constructor.
|
Node(int data)
Convenience constructor.
|
Node(int data,
Node left,
Node right)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getData()
Get the data stored in the
Node. |
Node |
getLeft()
Get the left child of the
Node. |
Node |
getRight()
Get the right child of the
Node. |
void |
setLeft(Node left)
Set the left child of the
Node. |
void |
setRight(Node right)
Set the right child of the
Node. |
java.lang.String |
toString()
Create a
String representation of the Node. |
public Node()
Node with no children.public Node(int data)
Node with the given data and no children.data - the data to store in the Nodepublic int getData()
Node.public Node getLeft()
Node.public Node getRight()
Node.public void setLeft(Node left)
Node.left - the new left childpublic void setRight(Node right)
Node.right - the new right childpublic java.lang.String toString()
String representation of the Node.toString in class java.lang.ObjectNode as a String