Which sort function is this?

Given some descriptions, determine the sort function that is the best described by the given descriptions.

  • Uses priority queue data structure

  • Extracts the first node of the priority queue and does the same thing recursively to its child nodes

  • Running time is O ( n log n ) O(n \log n)

Heapsort Quicksort Insertion sort All of the choices given

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

Valerian Pratama
Jun 9, 2015

The key statement is

"Uses priority queue data structure"

So the answer is Heapsort

Daniel Lim
Aug 2, 2014

Obviously heapsort is the answer because it uses priority queue.

Since it keeps splitting the queue into two parts, it takes O ( log n ) O(\log n) running time, and we'll do this to all elements so it is O ( n log n ) O(n \log n)

I came across this useful sorting algorithm video at 9GAG. Here's the link. This might help others to visualize or simply know about the sorting algorithms easily.

One can easily see that only heap is the algorithm that uses a priority queue from there.

Prasun Biswas - 6 years, 5 months ago

Log in to reply

Here's the source of this video .

Micah Wood - 6 years, 1 month ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...