Question 1Asked in UGC NET Computer Science, December 2015 (Paper II & III, Selected Questions)

In general, in a recursive and non-recursive implementation of problem (program) :

  1. ABoth time and space complexities are better in recursive than in non-recursive program
  2. BBoth time and space complexities are better in non-recursive than in recursive program
  3. CTime complexity is better in recursive version but space complexity is better in non-recursive version of the program
  4. DSpace complexity is better in recursive version but time complexity is better in non-recursive version of the program
Show answerHide answer

Correct answer: (B) Both time and space complexities are better in non-recursive than in recursive program

Explanation

Recursion does not offer better space or time complexity; it only makes the program compact and simpler to write and understand than a non-recursive implementation. The non-recursive version avoids function-call overhead and stack space.

From UGC NET Computer Science PYQ, December 2015 (Paper II & III, Selected Questions)

This is question 1 of UGC NET Computer Science PYQ, December 2015 (Paper II & III, Selected Questions). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.