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
(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.

In Figure 6.17

(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.

(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.5 For the binary tree of Figure 6.17, the corresponding se- quential representation would be as follows (assuming that stands for null): AB/D//CEG///FH//I// (6.1)
Step by Step Solution
3.46 Rating (149 Votes )
There are 3 Steps involved in it
Java class TreeNode char val TreeNode left TreeNode right TreeNodechar val thisval val thisleft null ... View full answer
Get step-by-step solutions from verified subject matter experts
