Question: 1. a. Using C/C++, define the tree node structure (e.g. value is an integer, left and right are a node type pointer) and build a
1. a. Using C/C++, define the tree node structure (e.g. value is an integer, left and right are a node type pointer) and build a binary search tree by giving 10 random numbers, b. Define three functions: inOrder). preOrder), and postOrder) to output the node values of the tree in three different orders. Finally, design a recursive function freeTreeNodes0 to free all memory of the binary tree. c. Based on 1a & 1b, define a function which search it a given number is in the tree. 2. a. While building a binary search tree (BST), if the numbers come in the following sequence: 8, 7, 9, 20, 11, 10, 12. 13, 5. 1; what will be the tree like after constructed? How many comparisons are made totally? b. Given the following binary tree, write the InOrder. PreOrder, PostOder traversals. c. Given a binary tree with 8 nodes, if its InOrder and Postorder traversal results are: InOrder Postorder 1 2345678 32147685 Reconstruct the tree according to the results; is this tree a binary search tree
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
