Question 11
Consider the following functions
Which of the following is true? (GATE CS 2000)
(A) h(n) is 0(f(n))
(B) h(n) is 0(g(n))
(C) g(n) is not 0(f(n))
(D) f(n) is 0(g(n))
Question 12
Consider the following three claims:
I [Tex](n + k)^m = \theta(n^m)[/Tex] where k and m are constants
II [Tex]2^{n+1} = O(2^n) [/Tex]
III 2^{2n+1} = O(2^n)
Which of these claims is correct? (GATE CS 2003)
Question 13
Let s be a sorted array of n integers. Let t(n) denote the time taken for the most efficient algorithm to determined if there are two elements with sum less than 1000 in s. which of the following statements is true? (GATE CS 2000)
a) t (n) is 0 (1)
b) n < t (n) < n[Tex] {log_2 n} [/Tex]
c) n log 2 n < t (n) < [Tex]{n \\choose 2} [/Tex]
d) t (n) = [Tex]{n \\choose 2} [/Tex]
Question 14
Consider the following function,
int unknown(int n) { int i, j, k = 0; for (i = n/2; i <= n; i++) for (j = 2; j <= n; j = j * 2) k = k + n/2; return k; }
What is the time complexity of the function? (GATE CS 2013)
Question 15
Consider the following two functions. What are time complexities of the functions?
int fun1(int n)
{
if (n <= 1) return n;
return 2*fun1(n-1);
}
int fun2(int n)
{
if (n <= 1) return n;
return fun2(n-1) + fun2(n-1);
}
Question 16
What is the worst case time complexity of insertion sort where position of the data to be inserted is calculated using binary search?
Question 17
Question 18
(A) [Tex]\\Theta(1)[/Tex] (B) [Tex]\\Theta(\\sqrt{logn})[/Tex] (C) [Tex]\\Theta(Log n/(Log Log n))[/Tex] (d) [Tex]\\Theta(Log n)[/Tex]
Question 19
int j, n; j = 1; while (j <= n) j = j*2;The number of comparisons made in the execution of the loop for any n > 0 is: Base of Log is 2 in all options.
Question 20
for (i = n, j = 0; i >0; i /= 2, j += i);
There are 118 questions to complete.