2.7k views

Which of the following sorting algorithms has the minimum running time complexity in the best and average case?

1. Insertion sort, Quick sort
2. Quick sort, Quick sort
3. Quick sort, Insertion sort
4. Insertion sort, Insertion sort
| 2.7k views

Insertion sort best case O(n)

Quick sort avg case O(n log n)

Ans (A)
by Veteran (119k points)
selected by
1. Insertion sort (n) , Quick sort( n logn)
2. Quick sort (n logn), Quick sort(n logn)
3. Quick sort (n logn)), Insertion sort(n2)
4. Insertion sort (n), Insertion sort(n2)
by Veteran (63k points)
edited
0
In bestcase Quick sort takes nlogn bt in option c u hv writtten Quick sort(n)  ??
+1
updated
+1 vote

Best Case                   Average Case

Insertion Sort                     O(n)                                O(n^2)

Quick Sort                       O(nlogn)                          O(nlogn)

---------------------                -----------------------

=>Minimum                      O(n)                               O(nlogn)

=================>Insertion Sort           ,        Quick Sort

So (A) is correct

by Active (2.8k points)