Open In App

UGC-NET | UGC NET CS 2015 Dec – II | Question 15

Like Article
Like
Save Article
Save
Share
Report issue
Report

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

(A)

Both time and space complexities are better in recursive than in non-recursive program.

(B)

Both time and space complexities are better in non-recursive than in recursive program

(C)

Time complexity is better in recursive version but space complexity is better in non-recursive version of the program.

(D)

Space complexity is better in recursive version but time complexity is better in non-recursive version of the program.


Answer: (B)

Explanation:

In general, in a recursive and non-recursive implementation of a problem (program) both time and space complexities are better in non-recursive than in recursive program. In some program recursive implementation gives worst case scenario too. So, recursive implementation does not guarantee for best case all the time. 

So, option (B) is correct.


Quiz of this Question
Please comment below if you find anything wrong in the above post


Last Updated : 23 Nov, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads