1.

What is the worst case runtime of linear search(recursive) algorithm?(a) O(n)(b) O(logn)(c) O(n^2)(d) O(nx)I had been asked this question at a job interview.The question is from Searching in portion Searching of Data Structures & Algorithms II

Answer»

Correct choice is (a) O(N)

Explanation: In the worst CASE scenario, there MIGHT be a need of CALLING the stack n TIMES. Therfore O(n).



Discussion

No Comment Found

Related InterviewSolutions