Write a method called printLeaves that prints to System.out the leaves of a binary tree from right
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 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
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Building Java Programs A Back To Basics Approach
ISBN: 9780135471944
5th Edition
Authors: Stuart Reges, Marty Stepp
Question Posted: