Q20
Consider the equality and the following choices for
The equality above remains correct if is replaced by
The equality above remains correct if is replaced by
Show answer without attempting
Answer: C
GATE CS · 15 questions
15 Algorithms questions from GATE CS papers (2015), each with the official answer key. Answer any question right here and it is marked straight away, or practise them one at a time.
Answer: C
Answer: 80
Answer: B
Answer: 995
Answer: D
Answer: C
Answer: B
Answer: D
Answer: A

Answer: 69
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)
++q;
}
return q;
}Answer: D
Answer: D
Answer: C
int partition(int a[], int n);int kth_smallest(int a[], int n, int k)
{
int left_end = partition(a,n);
if ( left_end+1 == k ){
return a[left_end];
}
if ( left_end+1 > k ){
return kth_smallest( ____________ );
} else {
return kth_smallest( ____________ );
}
}Answer: A
Answer: B
0/150 correct0 marks