InterviewSolution
Saved Bookmarks
| 1. |
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 saidI had been asked this question in an interview for job.The question is from Searching topic in section Searching of Data Structures & Algorithms II |
|
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). |
|