Question: A general tree in which all non-leaf nodes have null data can be implemented as a list of lists. For example, the tree is the
A general tree in which all non-leaf nodes have null data can be implemented as a list of lists. For example, the tree

is the list [[A, B], C, [D]].
Using the list implementation from Section 16.1.8, implement a tree class with the same interface as the one in Section 17.1. Use n instanceof List to check whether a list element n is a subtree or a leaf.
A B D
Step by Step Solution
3.46 Rating (156 Votes )
There are 3 Steps involved in it
The question indicates that we should implement a tree where nonleaf nodes contain null data and the tree representation should be in the form of list... View full answer
Get step-by-step solutions from verified subject matter experts
