+1 vote
in Data Structures & Algorithms II by (110k points)
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

1 Answer

+1 vote
by (614k points)
selected by
Best 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).

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.