Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Algorithms and Complexity – I (CS-3012)

Assignments III

1. Illustrate the operation of HEAPSORT on the array A = {11, 2, 9, 13, 57, 25, 17, 1, 90, 3}.
2. In a binary max heap containing n numbers, what is the time complexity to find the smallest
element can be found in the tree? Explain your answer.
3. Illustrate the operation of BUILD-MAX-HEAP on the array:
A = {12, 20, 2, 13, 32, 50, 88, 21, 18, 91}.
4. Illustrate the operation of HEAP-EXTRACT-MAX on the heap A<15, 13, 9, 5, 12, 8, 7, 4, 0,
6, 2, 1>.
5. Write pseudocode for the procedures HEAP-EXTRACT-MIN and HEAP-DECREASE-KEY
that implement a min-priority queue with a min-heap.

You might also like