Sorting and Divide and Conquer: GATE DA Previous Year Questions

Sorting and Divide and Conquer · Programming, Data Structures and Algorithms

5 questions · asked in 3 of 3 years (2024–2026)

MCQ 2 · MSQ 2 · NAT 11-mark 3 · 2-mark 2

2024Questions per year2026

Questions 1–5 of 5

Q1GATE 20261 markMCQ−0.33 if wrong
Consider that the quick sort algorithm is used to sort an array of nn distinct randomly ordered elements. In every call, the pivot is chosen as the first element of the current subarray.
Let T(n)T(n) denote the expected time to sort the array. Assume that the time to partition is linear in the size of the current subarray.

Which of the following recurrence relations correctly represents T(n)T(n) in this scenario?

Q2GATE 20262 marksMSQ
Consider the problem of sorting the given array in ascending order:

P=[1,2,3,5,4]P=[1,2,3,5,4]

Consider two sorting algorithms Bubble Sort (BS)\text{(BS)} and Insertion Sort (IS)\text{(IS)}.
Let N1\text{N1} be the total number of comparisons done by BS\text{BS} on the elements of P\text{P} and N2\text{N2} be the total number of comparisons done by IS\text{IS} on the elements of P\text{P}.

Which of the following options is/are correct?

One or more options are correct.

Q3GATE 20251 markMSQ
Suppose that insertion sort is applied to the array [1,3,5,7,9,11,x,15,13][1, 3, 5, 7, 9, 11, x, 15, 13] and it takes exactly two swaps to sort the array. Select all possible values of xx.

One or more options are correct.

Q4GATE 20241 markNAT
Consider sorting the following array of integers in ascending order using an in-place Quicksort algorithm that uses the last element as the pivot.

60708090100\begin{array}{|c|c|c|c|c|} \hline 60&70&80&90&100 \\ \hline \end{array}

The minimum number of swaps performed during this Quicksort is ____

Q5GATE 20242 marksMCQ−0.67 if wrong
Consider the following sorting algorithms:

(i) Bubble sort
(ii) Insertion sort
(iii) Selection sort

Which ONE among the following choices of sorting algorithms sorts the numbers in the array [4,3,2,1,5][4,3,2,1,5] in increasing order after exactly two passes over the array?

Keep practising

Topics in Programming, Data Structures and Algorithms

All DA topics ›