The GATE Grind

GATE 2021 CS – Question 19

Algorithms · Searching, Sorting and Hashing · 1 mark · Multiple choice

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?

  1. Selection sort
  2. Mergesort
  3. Insertion sort
  4. Quicksort using the last element as pivot

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.