Skip to content
Related Articles

Related Articles

Algorithms | InsertionSort | Question 6
  • Difficulty Level : Medium
  • Last Updated : 24 Jun, 2016

What is the best sorting algorithm to use for the elements in array are more than 1 million in general?
(A) Merge sort.

(B) Bubble sort.
(C) Quick sort.
(D) Insertion sort.


Answer: (C)

Explanation: Most practical implementations of Quick Sort use randomized version. The randomized version has expected time complexity of O(nLogn). The worst case is possible in randomized version also, but worst case doesn’t occur for a particular pattern (like sorted array) and randomized Quick Sort works well in practice.

Quick Sort is also a cache friendly sorting algorithm as it has good locality of reference when used for arrays.

Quick Sort is also tail recursive, therefore tail call optimizations is done.

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :