You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
716 B

6 years ago
  1. // Binary Search Tree Node class
  2. // Xiwei Wang
  3. public class BSTNode
  4. {
  5. // data members
  6. private String m_value;
  7. private BSTNode m_left;
  8. private BSTNode m_right;
  9. // constuctor
  10. public BSTNode(String value)
  11. {
  12. m_value = value;
  13. m_left = null;
  14. m_right = null;
  15. }
  16. // member methods
  17. public String getInfo()
  18. {
  19. return m_value;
  20. }
  21. public BSTNode getLeft()
  22. {
  23. return m_left;
  24. }
  25. public BSTNode getRight()
  26. {
  27. return m_right;
  28. }
  29. public void setLeft(BSTNode left)
  30. {
  31. m_left = left;
  32. }
  33. public void setRight(BSTNode right)
  34. {
  35. m_right = right;
  36. }
  37. }