1
GATE CSE 2008
MCQ (Single Correct Answer)
+2
-0.6
The minimum number of comparisons required to determine if an integer appears more than n/2 times in a sorted array of n integers is
2
GATE CSE 2008
MCQ (Single Correct Answer)
+2
-0.6
Consider the following C functions:
int f1(int n){
if(n == 0 || n == 1){
return n;
}
return (2 * f1(n - 1) + 3 * f1(n - 2));
}
int f2(int n){
int i;
int X[N], Y[N], Z[N];
X[0] = Y[0] = Z[0] = 0;
X[1] = 1; Y[1] = 2; Z[1] = 3;
for(i = 2; i <= n; i++){
X[i] = Y[i - 1] + Z[i - 2];
Y[i] = 2 * X[i];
Z[i] = 3 * X[i];
}
return X[n];
}
The returning time of f1(n) and f2(n) are3
GATE CSE 2008
MCQ (Single Correct Answer)
+2
-0.6
Consider the following C functions:
int f1(int n){
if(n == 0 || n == 1){
return n;
}
return (2 * f1(n - 1) + 3 * f1(n - 2));
}
int f2(int n){
int i;
int X[N], Y[N], Z[N];
X[0] = Y[0] = Z[0] = 0;
X[1] = 1; Y[1] = 2; Z[1] = 3;
for(i = 2; i <= n; i++){
X[i] = Y[i - 1] + Z[i - 2];
Y[i] = 2 * X[i];
Z[i] = 3 * X[i];
}
return X[n];
}
f1(8) and f2(8) return the values 4
GATE CSE 2007
MCQ (Single Correct Answer)
+2
-0.6
In the following C function, let n $$ \ge $$ m.
int gcd(n,m)
{
if (n % m == 0) return m;
n = n % m;
return gcd(m,n);
}
How many recursive calls are made by this function?Questions Asked from Complexity Analysis and Asymptotic Notations (Marks 2)
Number in Brackets after Paper Indicates No. of Questions
GATE CSE 2024 Set 1 (1)
GATE CSE 2023 (1)
GATE CSE 2022 (1)
GATE CSE 2021 Set 2 (1)
GATE CSE 2021 Set 1 (1)
GATE CSE 2019 (1)
GATE CSE 2016 Set 2 (1)
GATE CSE 2015 Set 1 (2)
GATE CSE 2015 Set 3 (1)
GATE CSE 2013 (1)
GATE CSE 2011 (1)
GATE CSE 2008 (5)
GATE CSE 2007 (3)
GATE CSE 2005 (3)
GATE CSE 2004 (4)
GATE CSE 2003 (1)
GATE CSE 2002 (2)
GATE CSE 2000 (1)
GATE CSE 1994 (1)
GATE CSE 1993 (1)
GATE CSE 1990 (1)
GATE CSE 1987 (2)
GATE CSE Subjects
Theory of Computation
Operating Systems
Algorithms
Database Management System
Data Structures
Computer Networks
Software Engineering
Compiler Design
Web Technologies
General Aptitude
Discrete Mathematics
Programming Languages