5,158 views
2 votes
2 votes

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

3 Answers

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

Quick sort avg case O(n log n)

Ans (A)
selected by
3 votes
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)
edited by
1 votes
1 votes

                                          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

Answer:

Related questions

5 votes
5 votes
2 answers
2
3 votes
3 votes
1 answer
3
makhdoom ghaya asked Jun 5, 2016
6,333 views
The built-in base class in java, which is used to handle all exceptions isRaiseExceptionErrorThrowable
1 votes
1 votes
1 answer
4
makhdoom ghaya asked Jun 5, 2016
7,840 views
Which of the following is not provided as a service in cloud computing?Infrastructure as a serviceArchitecture as a serviceSoftware as a servicePlatform as a service