Skip to content
Related Articles

Related Articles

Improve Article
GATE | GATE CS 2021 | Set 1 | Question 19
  • Last Updated : 24 May, 2021

Consider the following array.

Which algorithm out of the following options uses the least number of comparisons (among the array elements) to sort the above array in ascending order?
(A) Selection sort
(B) Mergesort
(C) Insertion sort
(D) Quicksort using the last element as pivot

Answer: (C)

Explanation: Since, given array is almost sorted in ascending order, so Insertion sort will give its best case with time complexity of order O(n).

Quiz of this Question

Attention reader! Don’t stop learning now. Learn all GATE CS concepts with Free Live Classes on our youtube channel.

My Personal Notes arrow_drop_up
Recommended Articles
Page :