Skip to content

Instantly share code, notes, and snippets.

@bilalq
Created December 7, 2012 21:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bilalq/4236861 to your computer and use it in GitHub Desktop.
Save bilalq/4236861 to your computer and use it in GitHub Desktop.
The node for the BST
public class TreeNode
{
private Comparable value;
TreeNode left, right;
public TreeNode(Comparable initValue)
{
value = initValue;
left = null;
right = null;
}
public TreeNode(Comparable initValue, TreeNode initLeft, TreeNode initRight)
{
value = initValue;
left = initLeft;
right = initRight;
}
public Comparable getValue()
{
return value;
}
public TreeNode getLeft()
{
return left;
}
public TreeNode getRight()
{
return right;
}
public void setValue(Comparable theNewValue)
{
value = theNewValue;
}
public void setLeft(Comparable theNewLeft)
{
this.left = new TreeNode(theNewLeft);
}
public void setRight(Comparable theNewRight)
{
right = new TreeNode(theNewRight);
}
}
@JetFault
Copy link

JetFault commented Dec 8, 2012

The Javas!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment