The time complexity of the following C function is (assume n > 0) int…

ISRO Scientist/Engineer SC · 2015 · Computer ScienceGATE · 2004 · CS

The time complexity of the following C function is (assume n > 0)

int recursive (int n) {
     if(n == 1)
     return (1);
     else
     return (recursive (n-1) + recursive (n-1));
}
  1. A.

    O(n)

  2. B.

    O(n log n)

  3. C.

    O(n2)

  4. D.

    O(2n)

Attempted by 442 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…