1
GATE CSE 2006
MCQ (Single Correct Answer)
+1
-0.3
Consider the following C-program fragment in which i, j and n are integer variables.
for (i = n, j = 0; i > 0; i /= 2, j += i);
let val (j) denote the value stored in the variable j after termination of the for loop. Which one of the following is true?
A
val (j) = $$\theta $$ (log n)
B
val (j) = ($$\sqrt n $$)
C
val (j) = $$\theta $$ (n)
D
val (j) = $$\theta $$ (n log n)
2
GATE CSE 2006
MCQ (Single Correct Answer)
+1
-0.3
In a binary max heap containing n numbers, the smallest element can be found in time
A
$$O(n)$$
B
$$O(\log n)$$
C
$$O(\log \log n)$$
D
$$O(1)$$
3
GATE CSE 2006
MCQ (Single Correct Answer)
+1
-0.3
Which one of the following in place sorting algorithms needs the minimum number of swaps?
A
Quick sort
B
Insertion sort
C
Selection sort
D
Heap sort
4
GATE CSE 2006
MCQ (Single Correct Answer)
+1
-0.3
An element in an array X is called a leader if it is greater than all elements to the right of it in X. The best algorithm to find all leaders in an array
A
Solves it in linear time using a left to right pass of the array
B
Solves it in linear time using a right to left pass of the array
C
Solves it using divide and conquer in time $$\theta \left( {n\log n} \right)$$
D
Solves it in time $$\theta \left( {{n^2}} \right)$$
EXAM MAP
Medical
NEET
Graduate Aptitude Test in Engineering
GATE CSEGATE ECEGATE EEGATE MEGATE CEGATE PIGATE IN
CBSE
Class 12