Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please help with Question #2 1. Randomly write down TWO DIFFERENT numbers (not including 2, 0, 4), followed by 2, 0, 4 as a number
Please help with Question #2
1. Randomly write down TWO DIFFERENT numbers (not including "2, "0", 4"), followed by 2, 0, 4 as a number sequence. Then complete the following tasks a) Present the number sequence you generated (1 point). b) Each number in the sequence you created is considered as a key for a node in a Binary Search Tree (BST). Construct the BST by adding each node in the given order Show the final tree you constructed (2 points) c) The following questions are based on the BST you constructed i. Which node is the root? (1 point) ii. What is the height of the tree? (1 point) iii. What is the depth of node "2"? (1 point) iv. Who is the parent of "2"? (1 point) v. Who is the sibling of "2"? (1 point) vi. Who are the children of node "2" (1 point) vii. Is your BST a full binary tree? If it is not, identify ONE node in this tree that violated the requirement for full binary tree. (1 point) vii. Is your BST a complete binary tree. If it is not, identify ONE node in this tree that violated the requirement for complete binary tree. (1 point) ix. Based on the current nature of the BST you constructed, present it in the most appropriate array structure (Consider the two array representations we discussed, use the one that you think is the most appropriate for the tree you constructed, assuming the shape of the tree won't change any longer) (1 point) x. Show the InOrder, PreOrder, and PostOrder traversal of the tree (1 point xi. Remove the "2" then the ROOT from the BST you constructed and show the Construct a MinHeap using the same sequence as you identified in task 1 (build the tree by for each traversal, no partial credit will be given) result after each removal (1 point for each removal) 2. adding the node one by one) Show your construction step by step. Re-draw the tree after each swap. (3 points. No credit will be awarded if intermediate steps are missin a) b) Present your MinHeap in the right array structure (1 point, no partial credit. Consider the two array binary tree representations we discussed, use the one that you think is the most appropriate for HEAP) c) Conduct one dequeue on your MinHeap i. Identify the node that needs to be removed. (1 point) Draw the final Tree after dequeue is done(1 point)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started