We can define a binary tree representation T² for an ordered general tree T as follows (see Figure 8.21):
¢ For each position p of T, there is an associated position p² of T².
¢ If p is a leaf of T, then p² in T² does not have a left child; otherwise the left child of p² is q², where q is the first child of p in T.
¢ If p has a sibling q ordered immediately after it in T, then q² is the right child of p² in T; otherwise p² does not have a right child.
Given such a representation T² of a general ordered tree T, answer each of the following questions:
a. Is a preorder traversal of T² equivalent to a preorder traversal of T?
b. Is a postorder traversal of T² equivalent to a postorder traversal of T?
c. Is an inorder traversal of T² equivalent to one of the standard traversals of T? If so, which one?
Enjoy 24/7 customer support for any queries or concerns you have.
Phone: +1 213 3772458
Email: support@gradeessays.com