FAQ: Linear Search: Conceptual - Worst Case Performance


This community-built FAQ covers the “Worst Case Performance” exercise from the lesson “Linear Search: Conceptual”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Search Algorithms

FAQs on the exercise Worst Case Performance

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!


In one of the worst cases, the target value is found. Is this case more efficient than the second case because it was able to find the target value in the list? Leave your thoughts on this post in the forum and then click ‘Next’ to move onto the next exercise.

Although it was a happy outcome to find the target value in the last location, it was no more efficient than not finding the value at all. :anguished:


I don’t think so, because it still had to check the last value, and checking the last value would be the very last iteration. The only difference is the print statement.


I agree, still had to examine entire list either way, resulting in worst case scenario


How do we find out that something is NOT in a list without going through the entire list? The worst case scenario is not found. O(N).

The second most worst case scenario is to be found at the end of the search.

Sucks when the last place you look is right where you put it in the first place.


I think we are all on the same page. The question is whether or not it is more efficient to find as the last item in a list. It’s not more efficient. But it is never-the-less a preferable outcome. Unless you don’t want to find something. Like maybe an oncologist looking at organs for cancer or something :confused: