Question: Write a method called printLeaves that prints to System.out the leaves of a binary tree from right to left. More specifically, the leaves should be
Write a method called printLeaves that prints to System.out the leaves of a binary tree from right to left. More specifically, the leaves should be printed in the reverse order that they would be printed using any of the standard traversals. If the tree is empty, your method should produce the output "no leaves". For example, if a variable t refers to reference tree #2, the call of t.printLeaves(); should produce the following output:
leaves: 9 4 0

Reference Tree #2 2 Reference Tree #1 1 7. 4 4 Reference Tree #3 2 3 8. 9. 3. 1.
Step by Step Solution
3.40 Rating (150 Votes )
There are 3 Steps involved in it
public void printLeaves if overall Root null Systemoutprintlnno ... View full answer
Get step-by-step solutions from verified subject matter experts
