Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.52 KB | None | 0 0
  1. // Just change your the TreeNode references to your class
  2. public void print()
  3.     {
  4.         TreeNode<E> currentNode = tree;
  5.         printNode(tree);
  6.     }
  7.     private void printNode(TreeNode<E> node)
  8.     {
  9.         if (node != null)
  10.         {
  11.             System.out.print(node.value + " ,");
  12.             if (node.left != null)
  13.             {
  14.                 printNode(node.left);
  15.             }
  16.             if (node.right != null)
  17.             {
  18.                 printNode(node.right);
  19.             }
  20.         }
  21.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement