A node in a general tree can have an arbitrary number of children. a. Describe a C++ implementation of a general tree in which every node contains an array of child pointers. Write a recursive...


A node in a general tree can have an arbitrary number of children. a. Describe a C++ implementation of a general tree in which every node contains an array of child pointers. 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 is illustrated in Figure 16-19 . Each node has two pointers: The left pointer points to the node’s oldest child and the right pointer points to 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 , as part b describes, to the left-child/right-child representation of a binary tree, as this chapter describes. Does one representation simplify the implementation of the ADT operations? Are the two representations ever the same?



May 03, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here