The GATE Grind

GATE Programming, Data Structures and Algorithms: Searching and sorting algorithms – Previous Year Questions

6 GATE previous year questions on Searching and sorting algorithms (Programming, Data Structures and Algorithms, Data Science and Artificial Intelligence) with answers and explanations, from every paper.

6 questions worth 9 marks in all (3 1-mark, 3 2-mark). Asked between 2024 and 2026, so you can see how the topic has been tested over time.

  1. GATE 2024 DA Q40 (2 marks, Multiple choice) – Let F(n) denote the maximum number of comparisons made while searching for an entry in a sorted array of size n using binary search. Which ONE of the…
  2. GATE 2024 DA Q45 (2 marks, Multiple choice) – Consider the following sorting algorithms: (i) Bubble sort (ii) Insertion sort (iii) Selection sort Which ONE among the following choices of sorting…
  3. GATE 2025 DA Q27 (1 mark, Multiple select) – For which of the following inputs does binary search take time O( n) in the worst case?
  4. GATE 2025 DA Q29 (1 mark, Multiple select) – Suppose that insertion sort is applied to the array [1, 3, 5, 7, 9, 11, x, 15, 13] and it takes exactly two swaps to sort the array. Select all…
  5. GATE 2026 DA Q31 (1 mark, Numerical answer) – Let A be a sorted array containing 1000 distinct integers. You perform a recursive binary search on A to find an element y. Suppose each comparison…
  6. GATE 2026 DA Q49 (2 marks, Multiple select) – Consider the problem of sorting the given array in ascending order: P = [1, 2, 3, 5, 4] Consider two sorting algorithms Bubble Sort (BS) and Insertion…