CARVIEW |
Algorithms GATE CS PYQ Quiz
Subject Wise PYQs Quiz on Algorithms GATE CS from 2025 to 2000
Question 1
The worst case running time to search for an element in a balanced in a binary search tree with n2^n elements is
(A) [Tex]\\Theta(n log n)[/Tex]
(B) [Tex]\\Theta (n2^n) [/Tex]
(C) [Tex]\\Theta (n) [/Tex]
(D) [Tex]\\Theta (log n) [/Tex]
A
B
C
D
Question 2
The recurrence relation capturing the optimal execution time of the Towers of Hanoi problem with n discs is
T(n) = 2T(n − 2) + 2
T(n) = 2T(n − 1) + n
T(n) = 2T(n/2) + 1
T(n) = 2T(n − 1) + 1
Question 3
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?
(A)
[Tex]A(n) = \\Omega(W(n))[/Tex]
(B)
[Tex]A(n) = \\Theta(W(n))[/Tex]
(C)
[Tex]A(n) = O(W(n))[/Tex]
(D)
[Tex]A(n) = o(W(n))[/Tex]
A
B
C
D
Question 4
Let G be a weighted graph with edge weights greater than one and G'be the graph constructed by squaring the weights of edges in G. Let T and T' be the minimum spanning trees of G and G', respectively, with total weights t and t'. Which of the following statements is TRUE?
T' = T with total weight t' = t2
T' = T with total weight t' < t2
T' != T but total weight t' = t2
None of the above
Question 5
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
O(n log n)
O(n2 log n)
O(n2 + log n)
O(n2)
Question 6
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 algorithm? Assume that, in any iteration, the shortest path to a vertex v is updated only when a strictly shorter path to v is discovered.
SDT
SBDT
SACDT
SACET
Question 7
Which one of the following statements is TRUE for all positive functions f (n)?
[Tex]f(n^{2}) = \theta (f(n^{2})) [/Tex], when f (n) is a polynomial
[Tex]f(n^{2}) = o (f(n^{2}))[/Tex]
[Tex]f(n^{2}) = O(f(n^{2})) [/Tex], when f (n) is an exponential function
[Tex]f(n^{2}) = Ω(f(n^{2}))[/Tex]
Question 8
Which one of the following is the recurrence equation for the worst case time complexity of the Quicksort algorithm for sorting n(≥ 2) numbers? In the recurrence equations given in the options below, c is a constant.
T(n) = 2T (n/2) + cn
T(n) = T(n – 1) + T(0) + cn
T(n) = 2T (n – 2) + cn
T(n) = T(n/2) + cn
Question 9
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?
O(n)
O(n*log(n))
O(n2)
O(n!)
Question 10
Θ (n2)
Θ (n*log(n))
Θ (n1.5)
Θ (n)
There are 198 questions to complete.