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

worst-case

GATE CSE & IT · Data Structures · 1987-2025

27
PYQs
89%
keyed
5
elite explanations
18
years appeared

Study anchor

Cormen et al. — Introduction to Algorithms (CLRS)

Algorithms, data structures, graph algorithms, complexity

Practice action

Start latest PYQ

PYQs in this concept

All concepts →
2025 Q41

An array A of length n with distinct elements is said to be bitonic if there is an index 1 ≤ i ≤ n such that A[1..i] is sorted in the non-decreasing order and A[i + 1..n] is sorted...

mediumanswer key
2025 PYQ

$$\text { 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[]]>A[j + 1]) then swap A[j] and A[j+1] } Let $A[...

easybasic explanation
2024 PYQ

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 thro...

easyanswer keyelite explanation
2021 PYQ

What is the worst-case number of arithmetic operations performed by recursive binary search on a sorted array of size n?

easyanswer keybasic explanation
2020 PYQ

What is the worst case time complexity of inserting n elements into an empty linked list, if the linked list needs to be maintained in sorted order?

easyanswer keybasic explanation
2019 PYQ

There are n unsorted arrays : A 1 , A 2 , …, A n . Assume that n is odd. Each of A 1 , A 2 , …, A n contains n distinct elements. There are no common elements between any two array...

mediumanswer keyelite explanation
2019 PYQ

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...

easybasic explanation
2016 PYQ

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

easyanswer key
2015 PYQ

Which one of the following is the recurrence equation for the worst case time complexity of the Quicksort algorithm for sorting n ( $$ \ge 2$$ ) numbers? In the recurrence equation...

easyanswer key
2015 PYQ

Assume that a mergesort algorithm in the worst case takes $$30$$ seconds for an input of size $$64.$$ Which of the following most closely approximates the maximum input size of a p...

mediumanswer 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
2014 PYQ

Let P be a QuickSort Program to sort numbers in ascending order using the first element as pivot. Let t 1 and t 2 be the number of comparisons made by P for the inputs {1, 2, 3, 4,...

mediumanswer key
2013 PYQ

Which one of the following is the tightest upper bound that represents the time complexity of inserting an object in to a binary search tree of n nodes?

easyanswer keyelite explanation
2013 PYQ

Consider the following operation along with Enqueue and Dequeue operations on queues, where k is a global parameter. MultiDequeue(Q){ m = k while (Q is not empty and m > 0) { Deque...

mediumanswer key
2012 PYQ

A list of n strings, each of length n, is sorted into lexicographic order using the merge-sort algorithm. The worst case running time of this computation is

mediumanswer key
2012 PYQ

Let W(n) and A(n) denote respectively, the worst case and average case running time of an algorithm executed on an input of size n. Which of the following is ALWAYS TRUE?

easyanswer keyelite explanation
2009 PYQ

What is the number of swaps required to sort n elements using selection sort, in the worst case?

easyanswer key
2009 PYQ

In quick sort, for sorting n elements, the (n/4)th smallest element is selected as pivot using an O(n) time algorithm. What is the worst case time complexity of the quick sort?

mediumanswer 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
2002 PYQ

In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element is

easyanswer key
2002 PYQ

In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element is

easyanswer keyelite explanation
2001 PYQ

Randomized quicksort is an extension of quicksort where the pivot is chosen randomly. What is the worst case complexity of sorting n numbers using randomized quicksort?

easyanswer key
1999 PYQ

Suppose we want to arrange the n numbers stored in any array such that all negative values occur before all positive ones. Minimum number of exchanges required in the worst case is

mediumanswer 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
1996 PYQ

Both’s algorithm for integer multiplication gives worst performance when the multiplier pattern is

mediumanswer 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
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