Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Just change your the TreeNode references to your class
- public void print()
- {
- TreeNode<E> currentNode = tree;
- printNode(tree);
- }
- private void printNode(TreeNode<E> node)
- {
- if (node != null)
- {
- System.out.print(node.value + " ,");
- if (node.left != null)
- {
- printNode(node.left);
- }
- if (node.right != null)
- {
- printNode(node.right);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement