+1 vote
in Data Structures & Algorithms II by (110k points)
Is there any difference in the speed of execution between linear serach(recursive) vs linear search(lterative)?

(a) Both execute at same speed

(b) Linear search(recursive) is faster

(c) Linear search(Iterative) is faster

(d) Cant be said

This question was posed to me during an interview.I need to ask this question from Searching in section Searching of Data Structures & Algorithms II

1 Answer

+1 vote
by (614k points)
selected by
 
Best answer
The correct choice is (c) Linear search(Iterative) is faster

The explanation is: The Iterative algorithm is faster than the latter as recursive algorithm has overheads like calling function and registering stacks repeatedly.

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

...