+1 vote
in Data Structures & Algorithms II by (110k points)
Is the space consumed by the linear search(recursive) and linear search(iterative) same?

(a) No, recursive algorithm consumes more space

(b) No, recursive algorithm consumes less space

(c) Yes

(d) Nothing can be said

I had been asked this question in an interview for job.The question is from Searching topic in section Searching of Data Structures & Algorithms II

1 Answer

+1 vote
by (614k points)
selected by
 
Best answer
Correct answer is (a) No, recursive algorithm consumes more space

For explanation: The recursive algorithm consumes more space as it involves the usage the stack space(calls the function numerous times).

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.

Categories

...