Previous year questions
Algorithms
125 questions from GATE CS 2011 to 2026, newest first.
Topics
All Algorithms 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 1, Q.41
Let be an undirected, edge-weighted graph with integer weights. The weight of a path is the sum of the weights of the edges in that path. The length of a path is the n...
Single-Source and All-Pairs Shortest Paths
GATE CS 2026 Set 1, Q.49
Let be a simple, undirected, edge-weighted graph with unique edge weights. Which of the following statements about the minimum spanning trees (MST) of is/are true?
Minimum Spanning Trees
GATE CS 2026 Set 1, Q.50
Consider the following pseudocode for depth-first search (DFS) algorithm which takes a directed graph as input, where and are the discovery time and fini...
Graph Traversals, Topological Sort and Connectivity
GATE CS 2026 Set 1, Q.55
An undirected, unweighted, simple graph is said to be 2-colorable if there exists a function such that for every …
Graph Traversals, Topological Sort and Connectivity
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 2026 Set 2, Q.32
Consider an array . Suppose the merge sort algorithm is executed on array to sort it in increasing order. The merge sort algorithm will c...
Divide and Conquer
GATE CS 2026 Set 2, Q.37
Let be a weighted directed acyclic graph with edges and vertices. Given and a source vertex in , which one of the following options gives the worst case t...
Single-Source and All-Pairs Shortest Paths
GATE CS 2026 Set 2, Q.38
Consider an array of integers of size . The indices of run from to . An algorithm is to be designed to check whether satisfies the condition given below.…
Searching and Sorting Algorithms
GATE CS 2026 Set 2, Q.39
Consider a table , where the elements , , represent the cost of the optimal solutions of different subproblems of a problem that is being solved us...
Dynamic Programming
GATE CS 2025 Set 1, Q.18
Let be any undirected graph with positive edge weights, and be a minimum spanning tree of . For any two vertices, and , let and be the...
Minimum Spanning Trees
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 2025 Set 1, Q.33
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 be...Searching and Sorting Algorithms
GATE CS 2025 Set 1, Q.43
Let be an undirected and unweighted graph with 100 vertices. Let denote the number of edges in a shortest path between vertices and in . Let the m...
Graph Traversals, Topological Sort and Connectivity
GATE CS 2025 Set 1, Q.64
The maximum value of such that the edge between the nodes B and C is included in every minimum spanning tree of the given graph is _________ . (answer in integer) An undirec...
Minimum Spanning Trees
GATE CS 2025 Set 2, Q.20
Consider an unordered list of distinct integers. What is the minimum number of element comparisons required to find an integer in the list that is NOT the largest in the list?
Searching and Sorting Algorithms
GATE CS 2025 Set 2, Q.29
Which of the following statements regarding Breadth First Search (BFS) and Depth First Search (DFS) on an undirected simple graph is/are TRUE?
Graph Traversals, Topological Sort and Connectivity
GATE CS 2025 Set 2, Q.37
Let be an edge-weighted undirected graph with positive edge weights. Suppose a positive constant is added to the weight of every edge. Which ONE of the following st...
Minimum Spanning Trees · Single-Source and All-Pairs Shortest Paths
GATE CS 2025 Set 2, Q.41
An array of length with distinct elements is said to be bitonic if there is an index such that is sorted in the non-decreasing order and…
Searching and Sorting Algorithms · Divide and Conquer
GATE CS 2025 Set 2, Q.59
Consider the following algorithm
someAlgothat takes an undirected graph as input. someAlgo(G) 1. Let v be any vertex in G. Run BFS on G starting at v. Let u be a vertex i...Graph Traversals, Topological Sort and Connectivity
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 1, Q.45
Let be a directed graph and a depth first search (DFS) spanning tree in that is rooted at a vertex . Suppose is also a breadth first search (BFS) tree in ,...
Graph Traversals, Topological Sort and Connectivity
GATE CS 2024 Set 1, Q.60
The number of edges present in the forest generated by the DFS traversal of an undirected graph with 100 vertices is 40. The number of connected components in is _________
Graph Traversals, Topological Sort and Connectivity
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 2024 Set 2, Q.35
Let be an array containing integer values. The distance of is defined as the minimum number of elements in that must be replaced with another integer so that the res...
Dynamic Programming
GATE CS 2024 Set 2, Q.42
Consider an array
Xthat containsnpositive integers. A subarray ofXis defined to be a sequence of array locations with consecutive indices. The C code snippet given be...Dynamic Programming · Data Types, Operators and Control Flow
GATE CS 2024 Set 2, Q.59
The number of distinct minimum-weight spanning trees of the following graph is _________ Undirected weighted graph with 7 vertices a, b, c, d, e, f, g and 12 edges: (a,b)=1, (a,...
Minimum Spanning Trees · Graph Theory
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 2022, Q.49
Consider a simple undirected weighted graph G, all of whose edge weights are distinct. Which of the following statements about the minimum spanning trees of G is/are TRUE?
Minimum Spanning Trees
GATE CS 2021 Set 1, Q.12 (CS Q.2)
Let be an array containing integers. Let be the lowest upper bound on the number of comparisons of the array elements, required to find the minimum and maximum value...
Searching and Sorting Algorithms
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.19 (CS Q.9)
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 the ab...
Searching and Sorting Algorithms
GATE CS 2021 Set 1, Q.27 (CS Q.17)
Consider the following undirected graph with edge weights as shown: A 3 by 3 grid graph with 9 vertices and labeled edge weights of 0.1 and 0.9. The number of minimum-weight spa...
Minimum Spanning Trees
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 1, Q.50 (CS Q.40)
Define to be the maximum amount earned by cutting a rod of length meters into one or more pieces of integer length and selling them. For , let denote the...
Dynamic Programming
GATE CS 2021 Set 1, Q.51 (CS Q.41)
An articulation point in a connected graph is a vertex such that removing the vertex and its incident edges disconnects the graph into two or more connected components. Let ...
Graph Traversals, Topological Sort and Connectivity
GATE CS 2021 Set 2, Q.11 (CS Q.1)
Let be a connected undirected weighted graph. Consider the following two statements. : There exists a minimum weight edge in which is present in every minimum spann...
Minimum Spanning Trees
GATE CS 2021 Set 2, Q.18 (CS Q.8)
What is the worst-case number of arithmetic operations performed by recursive binary search on a sorted array of size ?
Divide and Conquer
GATE CS 2021 Set 2, Q.36 (CS Q.26)
Consider the string
abbccddeee. Each letter in the string must be assigned a binary code satisfying the following properties: 1. For any two letters, the code assigned to one...Greedy Algorithms
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 2021 Set 2, Q.56 (CS Q.46)
Consider the following directed graph: A 4 by 4 directed grid graph with 16 solid black vertices and directed edges between adjacent vertices. The bottom-left vertex is labeled...
Graph Traversals, Topological Sort and Connectivity
GATE CS 2021 Set 2, Q.65 (CS Q.55)
In a directed acyclic graph with a source vertex , the quality-score of a directed path is defined to be the product of the weights of the edges on the path. Further, for a v...
Dynamic Programming
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.41 (CS Q.31)
Let be a weighted undirected graph and let be a Minimum Spanning Tree (MST) of maintained using adjacency lists. Suppose a new weighted edge…
Greedy Algorithms · Graph Traversals, Topological Sort and Connectivity
GATE CS 2020, Q.50 (CS Q.40)
Let be a directed, weighted graph with weight function . For some function , for each edge , define…
Graph Traversals, Topological Sort and Connectivity
GATE CS 2020, Q.59 (CS Q.49)
Consider a graph , where , , and weight of the edge is . The wei...
Greedy Algorithms · Graph Traversals, Topological Sort and Connectivity
GATE CS 2019, Q.30 (CS Q.20)
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...
Searching and Sorting Algorithms
GATE CS 2019, Q.35 (CS Q.25)
Consider a sequence of 14 elements: . The subsequence sum . Determine the maximum of…
Divide and Conquer
GATE CS 2019, Q.47 (CS Q.37)
There are unsorted arrays: . Assume that is odd. Each of contains distinct elements. There are no common elements betwee...
Divide and Conquer
GATE CS 2019, Q.48 (CS Q.38)
Let be any connected, weighted, undirected graph. I. has a unique minimum spanning tree, if no two edges of have the same weight. II. has a unique minimum spanni...
Greedy Algorithms
GATE CS 2018, Q.40 (CS Q.30)
Let be a simple undirected graph. Let be a depth first search tree of . Let be a breadth first search tree of . Consider the following statements. (I) No e...
Graph Traversals, Topological Sort and Connectivity
GATE CS 2018, Q.41 (CS Q.31)
Assume that multiplying a matrix of dimension with another matrix of dimension requires scalar multiplications. Computing the product...
Dynamic Programming
GATE CS 2018, Q.57 (CS Q.47)
Consider the following undirected graph G: Undirected weighted graph G with 5 vertices and 7 edges, with edge weights 1, 3, 4, 4, 4, 5, and variable x. Choose a value for th...
Greedy Algorithms
GATE CS 2018, Q.58 (CS Q.48)
Consider the weights and values of items listed below. Note that there is only one unit of each item. Item number Weight (in Kgs) Value (in Rupees) 1 10 60 2 7 28 3 4 20 4 2 24...
Dynamic Programming
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 1, Q.5 (CS Q.5)
Consider the following table: Algorithm Design Paradigm (P) Kruskal (i) Divide and Conquer (Q) Quicksort (ii) Greedy (R) Floyd-Warshall (iii) Dynamic Programming Match the algor...
Greedy Algorithms · Dynamic Programming · Divide and Conquer
GATE CS 2017 Set 1, Q.26 (CS Q.26)
Let be any connected undirected edge-weighted graph. The weights of the edges in are positive and distinct. Consider the following statements: (I) Minimum Spann...
Greedy Algorithms · Graph Theory
GATE CS 2017 Set 1, Q.48 (CS Q.48)
Let be an array of 31 numbers consisting of a sequence of 0's followed by a sequence of 1's. The problem is to find the smallest index such that is 1 by probing t...
Searching and Sorting Algorithms
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.15 (CS Q.15)
The Breadth First Search (BFS) algorithm has been implemented using the queue data structure. Which one of the following is a possible order of visiting the nodes in the graph b...
Graph Traversals, Topological Sort and Connectivity · Graph Representations and Disjoint Sets
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 2017 Set 2, Q.50 (CS Q.50)
A message is made up entirely of characters from the set . The table of probabilities for each of the characters is shown below: | Character | Probability...
Greedy Algorithms
GATE CS 2016 Set 1, Q.21 (CS Q.11)
Consider the following directed graph: Directed acyclic graph with six vertices labeled a, b, c, d, e, and f. Directed edges are from a to b, a to d, b to c, d to e, c to f, and...
Graph Traversals, Topological Sort and Connectivity
GATE CS 2016 Set 1, Q.23 (CS Q.13)
The worst case running times of Insertion sort, Merge sort and Quick sort, respectively, are:
Searching and Sorting Algorithms
GATE CS 2016 Set 1, Q.24 (CS Q.14)
Let be a weighted connected undirected graph with distinct positive edge weights. If every edge weight is increased by the same value, then which of the following statements...
Minimum Spanning Trees
GATE CS 2016 Set 1, Q.48 (CS Q.38)
Consider the weighted undirected graph with 4 vertices, where the weight of edge is given by the entry in the matrix …
Single-Source and All-Pairs Shortest Paths
GATE CS 2016 Set 1, Q.49 (CS Q.39)
Let be a complete undirected graph on 4 vertices, having 6 edges with weights being 1, 2, 3, 4, 5, and 6. The maximum possible weight that a minimum weight spanning tree of...
Minimum Spanning Trees
GATE CS 2016 Set 1, Q.50 (CS Q.40)
is an undirected simple graph in which each edge has a distinct weight, and is a particular edge of . Which of the following statements about the minimum spa...
Minimum Spanning Trees
GATE CS 2016 Set 2, Q.21 (CS Q.11)
Breadth First Search (BFS) is started on a binary tree beginning from the root vertex. There is a vertex at a distance four from the root. If is the -th vertex in thi...
Graph Traversals, Topological Sort and Connectivity
GATE CS 2016 Set 2, Q.23 (CS Q.13)
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...
Searching and Sorting Algorithms
GATE CS 2016 Set 2, Q.24 (CS Q.14)
The Floyd-Warshall algorithm for all-pair shortest paths computation is based on
Dynamic Programming
GATE CS 2016 Set 2, Q.48 (CS Q.38)
Let and be four matrices of dimensions , , , and , respectively. The minimum number of scalar multipl...
Dynamic Programming
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 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.16 (CS Q.6)
Match the following: | | Algorithm | | Design Paradigm | | :--- | :--- | :--- | :--- | | (P) | Prim's algorithm for minimum spanning tree | (i) | Backtracking | | (Q) | Floyd-Wa...
Greedy Algorithms
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 1, Q.53 (CS Q.43)
The graph shown below has 8 edges with distinct integer edge weights. The minimum spanning tree (MST) is of weight 36 and contains the edges: {(A, C), (B, C), (B, E), (E, F), (D...
Minimum Spanning Trees
GATE CS 2015 Set 1, Q.55 (CS Q.45)
Let be a simple undirected graph, and be a particular vertex in it called the source. For , let denote the shortest distance in from to...
Graph Traversals, Topological Sort and Connectivity
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 2, Q.32 (CS Q.22)
An unordered list contains distinct elements. The number of comparisons to find an element in this list that is neither maximum nor minimum is
Searching and Sorting Algorithms
GATE CS 2015 Set 2, Q.46 (CS Q.36)
Given below are some algorithms, and some algorithm design paradigms. List-I 1. Dijkstra's Shortest Path 2. Floyd-Warshall algorithm to compute all pairs shortest path 3. Bi...
Dynamic Programming
GATE CS 2015 Set 2, Q.55 (CS Q.45)
Suppose you are provided with the following function declaration in the C programming language:
int partition(int a[], int n);The function treats the first element ofa[]a...Searching and Sorting Algorithms
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.50 (CS Q.40)
Let be a connected undirected graph of 100 vertices and 300 edges. The weight of a minimum spanning tree of is 500. When the weight of each edge of is increased by f...
Minimum Spanning Trees
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.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.13 (CS Q.3)
Let be a directed graph where is the set of vertices and the set of edges. Then which one of the following graphs has the same strongly connected components as...
Graph Traversals, Topological Sort and Connectivity
GATE CS 2014 Set 1, Q.21 (CS Q.11)
Let be a graph with vertices and edges. What is the tightest upper bound on the running time of Depth First Search on , when is represented as an adjacency ma...
Graph Traversals, Topological Sort and Connectivity
GATE CS 2014 Set 1, Q.23 (CS Q.13)
Consider the directed graph given below. Directed graph on four vertices P, Q, R, and S Which one of the following is TRUE?
Graph Traversals, Topological Sort and Connectivity
GATE CS 2014 Set 1, Q.24 (CS Q.14)
Let be a quicksort program to sort numbers in ascending order using the first element as the pivot. Let and be the number of comparisons made by for the inpu...
Searching and Sorting Algorithms
GATE CS 2014 Set 1, Q.49 (CS Q.39)
The minimum number of comparisons required to find the minimum and the maximum of 100 numbers is _________________.
Searching and Sorting Algorithms
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 2, Q.24 (CS Q.14)
Consider the tree arcs of a BFS traversal from a source node in an unweighted, connected, undirected graph. The tree formed by the tree arcs is a data structure for comp...
Graph Traversals, Topological Sort and Connectivity
GATE CS 2014 Set 2, Q.47 (CS Q.37)
Consider two strings and . Let be the length of the longest common subsequence (not necessarily contiguous) between and an...
Dynamic Programming
GATE CS 2014 Set 2, Q.48 (CS Q.38)
Suppose P, Q, R, S, T are sorted sequences having lengths 20, 24, 30, 35, 50 respectively. They are to be merged into a single sequence by merging together two sequences at a ti...
Greedy Algorithms
GATE CS 2014 Set 2, Q.62 (CS Q.52)
The number of distinct minimum spanning trees for the weighted graph below is _____. Weighted undirected planar graph with edge weights 1 and 2 for MST enumeration Weighted grap...
Minimum Spanning Trees
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.23 (CS Q.13)
Suppose depth first search is executed on the graph below starting at some unknown vertex. Assume that a recursive call to visit a vertex is made only after first checking that...
Graph Traversals, Topological Sort and Connectivity
GATE CS 2014 Set 3, Q.24 (CS Q.14)
You have an array of 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...
Searching and Sorting Algorithms
GATE CS 2014 Set 3, Q.47 (CS Q.37)
Suppose you want to move from 0 to 100 on the number line. In each step, you either move right by a unit distance or you take a shortcut. A shortcut is simply a pre-specified...
Dynamic Programming
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 2014 Set 3, Q.52 (CS Q.42)
Consider the C function given below. Assume that the array listA contains n (> 0) elements, sorted in ascending order. int ProcessArray(int *listA, int x, int n) { int i, j...
Searching and Sorting Algorithms
GATE CS 2013, Q.6 (CS Q.6)
Which one of the following is the tightest upper bound that represents the number of swaps required to sort numbers using selection sort?
Searching and Sorting Algorithms
GATE CS 2013, Q.19 (CS Q.19)
What is the time complexity of Bellman-Ford single-source shortest path algorithm on a complete graph of vertices?
Single-Source and All-Pairs Shortest Paths
GATE CS 2013, Q.30 (CS Q.30)
The number of elements that can be sorted in time using heap sort is
Searching and Sorting Algorithms
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.29 (CS Q.29)
Let be a weighted graph with edge weights greater than one and be the graph constructed by squaring the weights of edges in . Let and be the minimum spannin...
Greedy Algorithms · Graph Traversals, Topological Sort and Connectivity
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 2012, Q.40 (CS Q.40)
Consider the directed graph shown in the figure below. There are multiple shortest paths between vertices S and T. Which one will be reported by Dijkstra's shortest path algorit...
Single-Source and All-Pairs Shortest Paths · Greedy Algorithms
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.25 (CS Q.25)
An algorithm to find the length of the longest monotonically increasing sequence of numbers in an array is given below. Let denote the length of the longest mon...
Dynamic Programming
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
GATE CS 2011, Q.38 (CS Q.38)
Four matrices and of dimensions , , and respectively can be multiplied in several ways with different num...
Dynamic Programming
GATE CS 2011, Q.54 (CS Q.54)
What will be the cost of the minimum spanning tree (MST) of such a graph with nodes?
Minimum Spanning Trees
GATE CS 2011, Q.55 (CS Q.55)
The length of the path from to in the MST of previous question with is
Minimum Spanning Trees