Read the authors question above and examine the following


a) Insert 28, 25, 26, 42, 47, 30, 45, 29, 5 into an initially empty binary search tree. Draw the final binary search tree.

b) Read the author's question above, and examine the following write-up to answer this question: is it true as stated; if not, why not?

"In the preorder traversal, the first node visited is the root node. Therefore, the first element of the preorder sequence becomes the root node of the tree. In the inordertraversal, the nodes in the left subtree of the root node are visited before the root node of the tree. Thus all elements that appear before the root node in the inorder sequence will be in the left subtree of the root node and all elements appearing after the root node will appear in the right subtree. Next, we consider the second element of the preorder sequence. If it appears before the root node in the inorder sequence, then it becomes the root node of the left subtree otherwise it becomes the root node of the right subtree. We repeat this process of determining whether the next element of the preorder sequence is in the left subtree of the current node or in the right subtree. When we arrive at an empty subtree the element (of the preorder sequence) is inserted into the tree."

 

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Read the authors question above and examine the following
Reference No:- TGS0661986

Expected delivery within 24 Hours