Open In App

Algorithms | InsertionSort | Question 6

Like Article
Like
Save
Share
Report

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


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads