Question: Question 5 In computer science, a binary tree is a data structure in which each node has at most two children, which are referred to

Question 5 In computer science, a binary tree is a data structure in which each node has at most two children, which are referred to as the left child and the right child. (a) Suppose the following items are inserted in the order given into an empty binary search tree. 16, 12, 7, 15, 8, 21, 9, 26, 4, 20, 32 1. Draw the resulting binary search tree. (6 marks) ii. List ALL the leaf nodes of the tree. (2 marks) ii. Give the preorder, inorder and postorder traversal of the tree. (6 marks) (b) Given the postfix expression below: a b + cd-refug i. Convert the expression to infix notation expression. (4 marks) ii. Create an expression tree for the expression (5 marks) iii. Write the prefix notation expression of the expression. (2 marks) [25 Mark]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
