A node in a general tree, such as the one in Figure, can have an arbitrary number of children.
a. Describe a Java implementation of a general tree in which every node contains an array of child references. Write a recursive preorder traversal method for this implementation. What are the advantages and disadvantages of this implementation?
b. Consider the implementation of a general tree that this chapter described. Each node has two references: The left one references the node’s oldest child and the right one references the node’s next sibling. Write a recursive preorder traversal method for this implementation.
c. Every node in a binary tree T has at most two children. Compare the oldest-child/next-sibling representation of T described in Part b to the left-child/ right-child representation of a binary tree described in this chapter. Does one representation simplify the implementation of the ADT operations? Are the two representations ever the same?
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.