Skip to content
Early access — you're among the first to try PYQLabs. Share feedback
Concept drill

sorting

GATE CSE & IT · Programming - C Language - Sorting Algorithms · 1987-2025

21
PYQs
90%
keyed
0
elite explanations
16
years appeared

Study anchor

Source-book anchor pending for this concept.

Practice action

Start latest PYQ

PYQs in this concept

All concepts →
2025 Q33

The pseudocode of a function fun () is given below: fun(int A[0,...,n-1]){ for i=0 to n-2 for j=0 to n-i-2 if (A[j]>A[j+1]) then swap A[j] and A[j+1] } Let A[0, ...,29] be an array...

mediumanswer key
2024 Q17

Given an integer array of size N, we want to check if the array is sorted (in either ascending or descending order). An algorithm solves this problem by making a single pass throug...

easyanswer key
2024 Q35

Let A be an array containing integer values. The distance of A is defined as the minimum number of elements in A that must be replaced with another integer so that the resulting ar...

mediumanswer key
2021 PYQ

Consider the following array. 23 32 45 69 72 73 89 97 Which algorithm out of the following options uses the least number of comparisons (among the array elements) to sort above arr...

easyanswer keybasic explanation
2017 Q43

Consider the following snippet of a C program. Assume that swap(&x, &y) exchanges the contents of x and y. int main() { int array[] = {3, 5, 1, 4, 6, 2}; int done = 0; int i; while...

mediumanswer key
2016 PYQ

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 ? $$\,\,\,\,\,\,...

easyanswer key
2016 PYQ

The worst case running times of Insertion sort, Merge sort and Quick sort, respectively, are:

easyanswer key
2014 PYQ

You have an array of n elements. Suppose you implement quicksort by always choosing the central element of the array as the pivot. Then the tightest upper bound for the worst case...

easyanswer key
2007 PYQ

Which of the following sorting algorithms has the lowest worst-case complexity?

easyanswer key
2006 PYQ

Which one of the following in place sorting algorithms needs the minimum number of swaps?

easyanswer key
2004 PYQ

The tightest lower bound on the number of comparisons, in the worst case, for comparison-based sorting is of the order of

easyanswer key
2004 PYQ

The tightest lower bound on the number of comparisons, in the worst case, for comparison-based sorting is of the order of

easyanswer key
2003 PYQ

The usual $$\Theta ({n^2})$$ implementation of Insertion Sort to sort an array uses linear search to identify the position where an element is to be inserted into the already sorte...

easyanswer key
1999 PYQ

A sorting technique is called stable if:

easyanswer key
1998 PYQ

There are five records in a database. Name Age Occupation Category Rama 27 CON A Abdul 22 ENG A Jennifer 28 DOC B Maya 32 SER D Dev 24 MUS C There is an index file associated with...

easyanswer key
1998 PYQ

Give the correct matching for the following pairs: Group - 1 (A) $${\rm O}(\log n)$$ (B) $${\rm O}(n)$$ (C) $${\rm O}(n\log n)$$ (D) $${\rm O}({n^2})$$ Group - 2 (P) Selection (Q)...

easyanswer keybasic explanation
1996 PYQ

Quicksort is run on two inputs shown below to sort in ascending order taking first element as pivot i) 1, 2, 3,......., n ii) n, n-1, n-2,......, 2, 1 Let C 1 and C 2 be the number...

easyanswer key
1992 PYQ

Assume that the last element of the set is used as partition element in Quicksort. If n distinct elements from the set [1…n] are to be sorted, give an input for which Quicksort tak...

easy
1992 PYQ

Following algorithm(s) can be used to sort n integers in the range [1....... n 3 ] in O(n) time

mediumanswer key
1991 PYQ

Minimum number of comparisons required to sort 5 elements

mediumbasic explanation
1987 PYQ

Let P be a quicksort program to sort numbers in ascending order. Let t 1 and t 2 be the time taken by the program for the inputs [1 2 3 4] and [5 4 3 2 1], respectively. Which of t...

easyanswer key