Which of the following algorithms runs in O(n log n)average time but O(N^2) worst-case
time?
(a) heapsort
(b) insertion sort
(c) mergesort
(d) quicksort
(e) shellsort
Answer
(d) quicksort
Which of the following algorithms runs in O(n log n)average time but O(N^2) worst-case
time?
(a) heapsort
(b) insertion sort
(c) mergesort
(d) quicksort
(e) shellsort
Answer
(d) quicksort