(a) Write a function to decode the sequential representation for binary trees illustrated by Example 6.5. The...

Question:

(a) Write a function to decode the sequential representation for binary trees illustrated by Example 6.5. The input should be the sequential representation and the output should be a pointer to the root of the resulting binary tree.

Example 6.5 For the binary tree of Figure 6.17, the corresponding se- quential representation would be as
In Figure 6.17

B D A G E (C) H F

(b) Write a function to decode the sequential representation for full binary trees illustrated by Example 6.6. The input should be the sequential representation and the output should be a pointer to the root of the resulting binary tree.

Example 6.6 We can represent the tree of Figure 6.17 as follows: A'B'/DC'E'G/F'HI (6.2)

(c) Write a function to decode the sequential representation for general trees illustrated by Example 6.8 . The input should be the sequential representation and the output should be a pointer to the root of the resulting general tree.

Example 6.8 For the general tree of Figure 6.3, we get the sequential representation RAC)D)E))BF))) (6.4)

A C D) (E R B TI F Figure 6.3 An example of a general tree.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: