Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

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

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

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

My Personal Notes arrow_drop_up
Last Updated : 23 Nov, 2022
Like Article
Save Article
Similar Reads