Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
53 views5 pages

GATE DPP2: Algorithms & Complexity Quiz

The document contains a series of questions related to algorithms, specifically focusing on time and space complexity. It includes multiple-choice questions assessing knowledge of transitive and reflexive relations, as well as the complexities of various code snippets. The questions are designed for a GATE examination in Data Structures and Algorithms.

Uploaded by

lohithkumarb6
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views5 pages

GATE DPP2: Algorithms & Complexity Quiz

The document contains a series of questions related to algorithms, specifically focusing on time and space complexity. It includes multiple-choice questions assessing knowledge of transitive and reflexive relations, as well as the complexities of various code snippets. The questions are designed for a GATE examination in Data Structures and Algorithms.

Uploaded by

lohithkumarb6
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

10/5/24, 9:49 PM GATE_DPP2

GATE

DS & AI
Algorithms DPP: 2

Analysis Algorithms
Q1 Which of the following natation is/are transitive What is the time complexity of above code?
but not reflexive (A) 0(n)
(A) Big oh (0) (B) 0 (fo)
(B) Big omega (Q) (C) 0 (log)
(C) Small oh (0) (D) 0(nlog (logn)
(D) Small omega (w)
QS Consider the following code:
Q2 If f(n) = E� 1 i 3
Algorithm T(n)
Then which of the following choices is/are true {
for f(n)? if (n = 1) return;
(A) 0 (n4) (B) [l (n4) else
(C)0(n 5 ) (D) [l (n 3) {
T(n/2);
Q3 Consider the following program:
}
main ( )
}
What is the space complexity of above code?
P= n!
(A) 0 (logn)
for (i = 1; i <= n ; ++i)
(B)0(n)
for (j = 1 ; j <= P ; 2*j )
(C) 0 (nloglogn)
C= C + 1;
(D) 0 ( yn)
}
Q6 f (n) = 2 n , g (n) = n! h (n) = 2 Iogn
2 2
What is the time complexity of above code?
(A) O(n2) (B) 0 (n2 logn) Which of the following is/are correct?
(C) 0 (n logn) (D) O(n) (A) f(n) = Q (g(n))
(B) h(n) = Q (g(n))
Q4 Consider the following code:
(C) h(n) = 0 (g(n))
main ( )
(D) g(n) = Q (f(n))
{
i = 1; j = 1 Q7 Consider the following rotations:
while (j <= n ) 1. Jiogn = 0 (loglog n)
{ 2. logn = Q (¾)
++ i; 3_ n2 = 0 (2 2logn)
j = j + i; 4. (O.O61t = 0(1.O2t
}

Q Android AP-P- I iOS AP-P- I PW Website

https://qbg.physicswallah.live/finalize-question-paper/print-preview 1/5

You might also like