GATE 2021 CS – Question 19
Consider the following array: [23, 32, 45, 69, 72, 73, 89, 97]. 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?
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (C) Insertion sort
Explanation
The array is already sorted. Insertion sort needs only $n-1=7$ comparisons. Selection sort, mergesort and quicksort need more.