Home /
Expert Answers /
Computer Science /
5-show-the-array-implementation-of-the-heap-in-figure-9-21-heap-for-exercises-5-6-and-7-6-appl-pa693
(Solved): 5. Show the array implementation of the heap in Figure 9-21. Heap for Exercises 5,6 , and 7 6. Appl ...
5. Show the array implementation of the heap in Figure 9-21. Heap for Exercises 5,6 , and 7 6. Apply the delete operation to the heap in Figure 9-21. Repair the heap after the deletion. 7. Insert 38 into the heap in Figure 9-21. Repair the heap after the insertion. 8. Show the left and right children of 32 and 27 in the heap in Figure 9-22. Also show the left children of 14 and 40. 9. In the heap in Figure 9-22, show the parent of 11 , the parent of 20 , and the parent of 25. 10. If a node is at index 25 , what is the index of its right child? What is the index of its left child? Assume the indeves start from 0 . 11. If a node is at index 37. what is the index of its parent? 12. Which of the following sequences are heaps? a. 423537201418710 b. 42351820143010 c. 202020202020 13. Show which item would be deleted from the following heap after calling the delete algorithm three times:
13. Show which item would be deleted from the following heap after calling the delete algorithm three times: 50?30?40?20?10?25?35?10?5? 14. Show the resulting heap after 33,22 , and 8 are added to the following heap: 50?30?40?20?10?25?35?10?5? 15. Draw a tree that is both a heap and a binary search tree. 16. Greate a priority queue using the following data. The first number is the priority, and the letter is the data. 3?A?5?B?3?C?2?D?1?E?2?F?3?G?2?H?2?I?2?J? 14. Show the contents of the priority queue in Exercise 16 after deteting three items fram the quetie: 18. Show the contents of the original priorits queue in Exercise If atter the follonting operations: Insen th. Insent 3-1. Delete. Insett 2 MI. Dedkte
1.7 Practice Sets Exercises 1. Show which of the structures in Figure 9-18 are heaps and which are not. 9-18 Heaps for Exercise 1 2. Make a heap out of the following data read from the keyboard: 23?7?92?6?12?14?40?44?20?21? 3. Apply the reheap up algorithm to the nonheap structure shown in Figure 9-19. 9-19 Nonheap Structure for Exercise 3 4. Apply the reheap down algorithm to the partial heap structure shown in Figure 9.20.