GATE CSE 2021 Set 1 Q19: Fewest comparisons to sort an already sorted array
- Algorithms
- 1 mark
- MCQ
- −1/3 if wrong
Question
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?
| 23 | 32 | 45 | 69 | 72 | 73 | 89 | 97 |
Try it: multiple choice: exactly one correct option
Show answer and explanation
Answer: C (official GATE 2021 final answer key)
Concept used: On sorted input insertion sort hits its best case of comparisons; quicksort with the last pivot hits its worst case.
First step: Note the array is already sorted, then count the comparisons each algorithm makes on sorted input.
Full step-by-step solution
Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.
Share this question
Source: official GATE 2021 Set 1 CS question paper and final answer key, organised by IIT Bombay. Question paper · Answer key
More Algorithms PYQs
- 2026 Session 1 · Q17Solve nested recurrences T1 = 4T1(n/2) + T2, T2 = 5T2(n/4) + log n
- 2026 Session 1 · Q41Shortest paths with at most k edges: two statements
- 2026 Session 1 · Q47Condition forcing a vertex into every minimum vertex cover
- 2026 Session 1 · Q49Cycle and cut properties of MSTs with distinct weights
- 2026 Session 1 · Q50Impossible DFS discovery/finish orderings for a DAG edge
- 2026 Session 1 · Q55Properties of 2-colorable (bipartite) graphs