1.

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 saidThis question was posed to me during an interview.I need to ask this question from Searching in section Searching of Data Structures & Algorithms II

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.



Discussion

No Comment Found

Related InterviewSolutions