Open In App

Algorithms | InsertionSort | Question 2

Which is the correct order of the following algorithms with respect to their time Complexity in the best case ?
(A) Merge sort > Quick sort >Insertion sort > selection sort
(B) insertion sort < Quick sort < Merge sort < selection sort
(C) Merge sort > selection sort > quick sort > insertion sort
(D) Merge sort > Quick sort > selection sort > insertion sort

Answer: (B)
Explanation:

In best case, 

Quick sort: O (nlogn) 
Merge sort: O (nlogn)
Insertion sort: O (n)
Selection sort: O (n^2)  

Quiz of this Question

Article Tags :