February 2014
Beginner
1248 pages
62h 25m
English
Methods inorderTraversal, preorderTraversal and postorderTraversal call Tree helper methods inorderHelper (lines 88–96), preorderHelper (lines 71–79) and postorderHelper (lines 105–113), respectively, to traverse the tree and print the node values. The helper methods in class Tree enable you to start a traversal without having to pass the root node to the method. Reference root is an implementation detail that a programmer should not be able to access. Methods inorderTraversal, preorderTraversal and postorderTraversal simply take the private root reference and pass it to the appropriate helper method to initiate a traversal of the tree. The base case for each helper method ...
Read now
Unlock full access