Sorting: GATE CS Previous Year Questions

Sorting · Algorithms

24 questions · asked in 15 of 27 years (2000–2026)

MCQ 22 · NAT 21-mark 17 · 2-mark 7

2000Questions per year2026

Questions 1–5 of 24

Q1GATE 2026 (Session 2)1 markNAT
Consider an array A=[10,7,8,19,41,35,25,31]A=[10,7,8,19,41,35,25,31]. Suppose the merge sort algorithm is executed on array AA to sort it in increasing order. The merge sort algorithm will carry out a total of 77 merge operations.

A merge operation on sorted left array LL and sorted right array RR is said to be void if the output of the merge operation is the elements of array LL followed by the elements of array RR.

The number of void merge operations among these 77 merge operations is ________. (answer in integer)

Q2GATE 2021 (Session 1)1 markMCQ−0.33 if wrong
Consider the following array.

2332456972738997\begin{array}{|l|l|l|l|l|l|l|l|} \hline 23&32&45&69&72&73&89&97 \\ \hline\end{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?

Q3GATE 20191 markNAT
An array of 25 distinct elements is to be sorted using quicksort. Assume that the pivot element is chosen uniformly at random. The probability that the pivot element gets placed in the worst possible location in the first round of partitioning (rounded off to 2 decimal places) is _________.

Q4GATE 2016 (Session 1)1 markMCQ−0.33 if wrong
The worst case running times of Insertion sort, Mergesort and Quicksort, respectively, are:

Q5GATE 2016 (Session 2)1 markMCQ−0.33 if wrong
Assume that the algorithms considered here sort the input sequences in ascending order. If the input is already in ascending order, which of the following are TRUE?
I. Quicksort runs in Θ(n2)\Theta (n^{2}) time
II. Bubblesort runs in Θ(n2)\Theta (n^{2}) time
III. Merge sort runs in Θ(n)\Theta (n) time
IV. Insertion sort runs in Θ(n)\Theta (n) time

Keep practising

Topics in Algorithms

All CS topics ›