Algorithms · Previous year questions
Asymptotic Analysis and Time/Space Complexity
42 questions from GATE CS 2011 to 2026, newest first.
Questions
GATE CS 2026 Set 1, Q.17
Consider the following recurrence relations: For all , Ass...
Asymptotic Analysis and Time/Space Complexity
GATE CS 2026 Set 2, Q.24
Consider the following functions, where is a positive integer. Which one of the following options lists the fun...
Asymptotic Analysis and Time/Space Complexity
GATE CS 2026 Set 2, Q.25
Which of the following can be recurrence relation(s) corresponding to an algorithm with time complexity ?
Asymptotic Analysis and Time/Space Complexity
GATE CS 2025 Set 1, Q.20
Consider the following recurrence relation: Which ONE of the following options is CORRECT?
Asymptotic Analysis and Time/Space Complexity
GATE CS 2024 Set 1, Q.17
Given an integer array of size , 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 t...
Asymptotic Analysis and Time/Space Complexity · Searching and Sorting Algorithms
GATE CS 2024 Set 1, Q.42
Consider the following recurrence relation: Which one of the follow...
Asymptotic Analysis and Time/Space Complexity
GATE CS 2024 Set 2, Q.15
Let be the recurrence relation defined as follows: , , and for Which one of the following statements is TRUE?
Asymptotic Analysis and Time/Space Complexity · Combinatorics, Counting, Recurrence Relations and Generating Functions
GATE CS 2023, Q.29
Let and be functions of natural numbers given by and . Which of the following statements is/are TRUE?
Asymptotic Analysis and Time/Space Complexity
GATE CS 2023, Q.54
Consider functions Function 1 and Function 2 expressed in pseudocode as follows: Function 1 Function 2 while n > 1 do for i = 1 to 100 * n do for i = 1 to n do x = x + 1; x...
Asymptotic Analysis and Time/Space Complexity
GATE CS 2022, Q.11
Which one of the following statements is TRUE for all positive functions ?
Asymptotic Analysis and Time/Space Complexity
GATE CS 2021 Set 1, Q.13 (CS Q.3)
Consider the following three functions. Which one of the following options arranges the functions in the increas...
Asymptotic Analysis and Time/Space Complexity
GATE CS 2021 Set 1, Q.40 (CS Q.30)
Consider the following recurrence relation. Which one of the following opti...
Asymptotic Analysis and Time/Space Complexity
GATE CS 2021 Set 2, Q.49 (CS Q.39)
For constants and , consider the following recurrence defined on the non-negative integers: Which one of the...
Asymptotic Analysis and Time/Space Complexity
GATE CS 2020, Q.12 (CS Q.2)
For parameters and , both of which are , , and . Then is
Asymptotic Analysis and Time/Space Complexity
GATE CS 2020, Q.16 (CS Q.6)
What is the worst case time complexity of inserting elements into an AVL-tree with elements initially?
Binary Trees, Binary Search Trees and Balanced Trees · Asymptotic Analysis and Time/Space Complexity
GATE CS 2020, Q.26 (CS Q.16)
What is the worst case time complexity of inserting elements into an empty linked list, if the linked list needs to be maintained in sorted order?
Arrays and Linked Lists · Asymptotic Analysis and Time/Space Complexity
GATE CS 2020, Q.51 (CS Q.41)
In a balanced binary search tree with elements, what is the worst case time complexity of reporting all elements in range ? Assume that the number of reported elemen...
Binary Trees, Binary Search Trees and Balanced Trees · Asymptotic Analysis and Time/Space Complexity
GATE CS 2017 Set 1, Q.4 (CS Q.4)
Consider the following functions from positive integers to real numbers: The CORRECT arrangement of the abov...
Asymptotic Analysis and Time/Space Complexity
GATE CS 2017 Set 2, Q.3 (CS Q.3)
Match the algorithms with their time complexities: | Algorithm | Time complexity | | :--- | :--- | | (P) Towers of Hanoi with disks | (i) | | (Q) Binary search...
Asymptotic Analysis and Time/Space Complexity · Searching and Sorting Algorithms
GATE CS 2017 Set 2, Q.30 (CS Q.30)
Consider the recurrence function Then in terms of notation is
Asymptotic Analysis and Time/Space Complexity
GATE CS 2017 Set 2, Q.38 (CS Q.38)
Consider the following C function. int fun(int n) { int i, j; for (i = 1; i <= n; i++) { for (j = 1; j < n; j += i) { printf("%d %d", i, j); } } } Time complexity of…
Asymptotic Analysis and Time/Space Complexity
GATE CS 2016 Set 2, Q.49 (CS Q.39)
The given diagram shows the flowchart for a recursive function . Assume that all statements, except for the recursive calls, have time complexity. If the worst case...
Asymptotic Analysis and Time/Space Complexity
GATE CS 2016 Set 2, Q.51 (CS Q.41)
In an adjacency list representation of an undirected simple graph , each edge has two adjacency list entries: in the adjacency list of , and ...
Graph Representations and Disjoint Sets · Asymptotic Analysis and Time/Space Complexity
GATE CS 2015 Set 1, Q.12 (CS Q.2)
Which one of the following is the recurrence equation for the worst case time complexity of the Quicksort algorithm for sorting () numbers? In the recurrence equati...
Asymptotic Analysis and Time/Space Complexity
GATE CS 2015 Set 1, Q.41 (CS Q.31)
Consider the following C function: int fun1(int n) { int i, j, k, p, q = 0; for (i = 1; i < n; ++i) { p = 0; for (j = n; j > 1; j = j / 2) ++p; for (k = 1; k < p; k = k * 2...
Asymptotic Analysis and Time/Space Complexity
GATE CS 2015 Set 2, Q.12 (CS Q.2)
Consider two decision problems such that reduces in polynomial time to 3-SAT and 3-SAT reduces in polynomial time to . Then which one of the following is c...
Asymptotic Analysis and Time/Space Complexity
GATE CS 2015 Set 3, Q.14 (CS Q.4)
Consider the equality and the following choices for …
Asymptotic Analysis and Time/Space Complexity
GATE CS 2015 Set 3, Q.37 (CS Q.27)
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 proble...
Searching and Sorting Algorithms · Asymptotic Analysis and Time/Space Complexity
GATE CS 2015 Set 3, Q.52 (CS Q.42)
Let and , where is a positive integer. Which of the following statements is/are correct? I. II.
Asymptotic Analysis and Time/Space Complexity
GATE CS 2015 Set 3, Q.59 (CS Q.49)
Suppose is an array of length , where all the entries are from the set . For any positive integers and , consider the following...
Combinatorics, Counting, Recurrence Relations and Generating Functions · Asymptotic Analysis and Time/Space Complexity
GATE CS 2015 Set 3, Q.63 (CS Q.53)
Language is polynomial time reducible to language . Language is polynomial time reducible to , which in turn is polynomial time reducible to language ...
Asymptotic Analysis and Time/Space Complexity
GATE CS 2014 Set 1, Q.52 (CS Q.42)
Consider the following pseudo code. What is the total number of multiplications to be performed? D = 2 for i = 1 to n do for j = i to n do for k = j + 1 to n do D = D *...
Asymptotic Analysis and Time/Space Complexity
GATE CS 2014 Set 2, Q.23 (CS Q.13)
Which one of the following correctly determines the solution of the recurrence relation with ?
Asymptotic Analysis and Time/Space Complexity
GATE CS 2014 Set 3, Q.21 (CS Q.11)
The minimum number of arithmetic operations required to evaluate the polynomial for a given value of , using only one temporary variable is _____.
Asymptotic Analysis and Time/Space Complexity
GATE CS 2014 Set 3, Q.48 (CS Q.38)
Consider the decision problem 2CNFSAT defined as follows: For e...
Asymptotic Analysis and Time/Space Complexity
GATE CS 2012, Q.4 (CS Q.4)
Assuming , which of the following is TRUE?
Asymptotic Analysis and Time/Space Complexity
GATE CS 2012, Q.16 (CS Q.16)
The recurrence relation capturing the optimal execution time of the Towers of Hanoi problem with discs is
Divide and Conquer · Asymptotic Analysis and Time/Space Complexity
GATE CS 2012, Q.18 (CS Q.18)
Let and denote respectively, the worst case and average case running time of an algorithm executed on an input of size . Which of the following is ALWAYS TRUE?
Asymptotic Analysis and Time/Space Complexity
GATE CS 2012, Q.39 (CS Q.39)
A list of strings, each of length , is sorted into lexicographic order using the merge-sort algorithm. The worst case running time of this computation is
Searching and Sorting Algorithms · Asymptotic Analysis and Time/Space Complexity
GATE CS 2011, Q.5 (CS Q.5)
A company needs to develop a strategy for software product development for which it has a choice of two programming languages L1 and L2. The number of lines of code (LOC) develo...
Asymptotic Analysis and Time/Space Complexity
GATE CS 2011, Q.7 (CS Q.7)
A company needs to develop digital signal processing software for one of its newest inventions. The software is expected to have 40000 lines of code. The company needs to determ...
Asymptotic Analysis and Time/Space Complexity
GATE CS 2011, Q.37 (CS Q.37)
Which of the given options provides the increasing order of asymptotic complexity of functions and ?…
Asymptotic Analysis and Time/Space Complexity