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, optipon (B) is correct.
Quiz of this Question
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.