

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


1.1 Assume the following max-heap is stored using the array representation: [51, 40 , 30 , 29 , 31 , 28 , 27 , 11 , 15 , 6 , 7 , 10 , 12 , 4] a) [2 points] Give the final array after 39 is enqueued to the heap. b) [2 points] Use Floyd’s heapifying algorithm to convert the original heap into a min-heap. c) [1 point] What is the easiest way to find the minimum value in a max-heap?
2.1 Given the following heap: 4 12 13 45 60
a) [4 points] Assume the heap is a leftist heap. Give the final heap after the minimum valueis dequeued. Indicate the NPL values for each node in brackets. b) [3 points] Assume the heap is a skew heap. Give the final heap after 30 is enqueued.
Page 1 of 2
COS 212: Tutorial 6: Exercise: 2026/04/
3.1 Assume that the following tree and array are used to store a treap: 0 1 3 4
a) [2 points] Give the final tree and array after G is inserted with a priority of 1. b) [2 points] Give the final tree and array after N is deleted from the treap.
Page 2 of 2