GATE CS 2021 Set 1 | Question 19
Algorithms › Sorting & Searching · MCQ · 1 mark · Answer: C
- Question 19Algorithmsmcq1 markConsider 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?23 32 45 69 72 73 89 97- A.Selection sort
- B.Mergesort
- C.Insertion sort✓
- D.Quicksort using the last element as pivot
Answer: C
Solution
The array is already sorted. Insertion sort on an already-sorted array performs only comparisons (best case), fewer than the others. - A.
More GATE PYQ on Sorting & Searching
All GATE CS Algorithms PYQ →Attempt GATE CS 2021 Set 1 in real GATE exam mode
Full paper with a timer, the GATE interface and a topic-wise analysis — free.
Create free account →