Question: Question 2 (10 points) (a) Draw a binary tree with 10 nodes labeled 0,1,...,9 in such a way that the inorder and postorder traversals of

Question 2 (10 points) (a) Draw a binary tree with 10 nodes labeled 0,1,...,9 in such a way that the inorder and postorder traversals of the tree yield the following lists: 1,5,4,0,9,3,2,7,6,8 (inorder) and 1,4,0,9,5,6.,8,7,2,3 (postorder). inorder and postorder traversal lists of the same binary tree. 0,1,,n- 1 are generated by the inorder and postorder traversals of the tree. Your (b) Give an example of two permutations of the same n labels 0, 1,... ,n - 1 that cannot be (c) Design an algorithm that constructs a binary tree for which two given lists of n labels algorithm should also indentify inputs for which the problem has no solution. Question 2 (10 points) (a) Draw a binary tree with 10 nodes labeled 0,1,...,9 in such a way that the inorder and postorder traversals of the tree yield the following lists: 1,5,4,0,9,3,2,7,6,8 (inorder) and 1,4,0,9,5,6.,8,7,2,3 (postorder). inorder and postorder traversal lists of the same binary tree. 0,1,,n- 1 are generated by the inorder and postorder traversals of the tree. Your (b) Give an example of two permutations of the same n labels 0, 1,... ,n - 1 that cannot be (c) Design an algorithm that constructs a binary tree for which two given lists of n labels algorithm should also indentify inputs for which the problem has no solution
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
