Asymptotic Notation: GATE CS Previous Year Questions

Asymptotic Notation · Algorithms

40 questions · asked in 21 of 27 years (2000–2026)

MCQ 37 · MSQ 2 · NAT 11-mark 27 · 2-mark 13

2000Questions per year2026

Questions 31–35 of 40

Q31GATE 20051 markMCQ−0.33 if wrong
Consider the following C-function:
 double foo (int n)
{
    int i;
    double sum;
    if (n == 0) return 1.0;
    else
    {
        sum = 0.0;
        for (i = 0; i < n; i++)
            sum += foo (i);
        return sum;
    }
} 
The space complexity of the above function is:

Q32GATE 20051 markMCQ−0.33 if wrong
The time complexity of computing the transitive closure of a binary relation on a set of n elements is known to be:

Q33GATE 20041 markMCQ−0.33 if wrong
Let f(n), g(n) and h(n) be functions defined for positive integers such that
f(n)=O(g(n)),  g(n)≠O(f(n)),  g(n)=O(h(n)), and h(n)=O(g(n)).f(n) = O(g(n)), \; g(n) \neq O(f(n)), \; g(n) = O(h(n)), \text{ and } h(n) = O(g(n)).
Which one of the following statements is FALSE?

Q34GATE 20041 markMCQ−0.33 if wrong
The time complexity of the following C function is (assume n >\gt 0)
int recursive (int n) {
   if (n == 1)
      return (1);
   else
      return (recursive (n - 1) + recursive (n - 1));
} 

Q35GATE 20041 markMCQ−0.33 if wrong
Let A[1,..., n] be an array storing a bit (1 or 0) at each location, and f(m) is a function whose time complexity is θ\theta(m). Consider the following program fragment written in a C like language:
 counter = 0;
for (i = 1; i <= n; i++)
{ 
      if (A[i] == 1) 
         counter++;
      else {
         f(counter); 
         counter = 0;
      }
}
The complexity of this program fragment is

Keep practising

Topics in Algorithms

All CS topics ›