Q. Traverse the tree in depth and return a list of all passed nodes. It should handle different data types as Double, String, etc. The interface for the tree node is
|
1 2 3 4 5 6 7 8 |
package tree; import java.util.List; public interface Node<E> { E getValue(); List<Node<E>> getChildren(); } |
A. Tree storing numbers: Tree storing text: #1….