need solution plz Question 1 (CLO-4, PLo-3) Figure 1 show an input tree T. 1. Analyze the tree and mention weather the tree is a heap or not by checking heap's property. If yes, justify your a...
Question 1 (CLO-4, PLo-3) Figure 1 show an input tree T. 1. Analyze the tree and mention weather the tree is a heap or not by checking heap's property. If yes, justify your answer. If no, make it a heap by adjusting the node's location 2. Alter the value of T[l1] to 100 using alter-heap algorithm. Analyze the tree again and state whether i. The tree is still a heap or not? ii. If not, which one of the following algorithms you will select to make it a heap? . Percolation Sift-down ii. Use the selected algorithm to maintain the heap 3. Once maintained, outline the maximum value from the heap made in part (ii). 4. Delete the largest element from the heap maintained in part (ii) and remake the heap again by selecting the appropriate algorithm. Insert a new node in the heap mentioned in Figure I. Assign a value to the new node 5. 79. Maintain the max heap structure again by selecting the appropriate algorithm. Question 2 (CLO-4, PLO0-3) 1. Sort the heap mentioned in Figure 1 in ascending order by selecting Min. heap sort algorithm. Show first six iterations only to elaborate your answer. 84 72 70 62 61 19 42 31 50 21 Figure. 1: Input Tree (T)
Question 1 (CLO-4, PLo-3) Figure 1 show an input tree T. 1. Analyze the tree and mention weather the tree is a heap or not by checking heap's property. If yes, justify your answer. If no, make it a heap by adjusting the node's location 2. Alter the value of T[l1] to 100 using alter-heap algorithm. Analyze the tree again and state whether i. The tree is still a heap or not? ii. If not, which one of the following algorithms you will select to make it a heap? . Percolation Sift-down ii. Use the selected algorithm to maintain the heap 3. Once maintained, outline the maximum value from the heap made in part (ii). 4. Delete the largest element from the heap maintained in part (ii) and remake the heap again by selecting the appropriate algorithm. Insert a new node in the heap mentioned in Figure I. Assign a value to the new node 5. 79. Maintain the max heap structure again by selecting the appropriate algorithm. Question 2 (CLO-4, PLO0-3) 1. Sort the heap mentioned in Figure 1 in ascending order by selecting Min. heap sort algorithm. Show first six iterations only to elaborate your answer. 84 72 70 62 61 19 42 31 50 21 Figure. 1: Input Tree (T)