The Gateway to Computer Science Excellence
+2 votes
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
in Algorithms by Boss (30.9k points) | 2.7k views

3 Answers

+5 votes
Best answer
Insertion sort best case O(n)

Quick sort avg case O(n log n)

Ans (A)
by Veteran (119k points)
selected by
+3 votes
  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 by
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)
Answer:

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,390 answers
198,589 comments
105,443 users