You are on page 1of 1

Adeena Saifullah 19655

LAB TASK 13

A)

B) Merge sort is taking 7200 nanoseconds on an almost sorted array of 7 elements and heap sort is
taking 4900 nano second on the same almost sorted array. Thus, merge sort takes more time in this
case.

C) Application of heap: I watched a video where they mentioned that heaps are used in priority queues.
So for example a min heap can be used to determine which task has the least amount of time left in its
deadline and thus we can retreive that task first (by using deletion method of min heap) in order to
complete it.

You might also like