FAQ: Binary Search: Conceptual - Time Complexity of Binary Search

This community-built FAQ covers the “Time Complexity of Binary Search” exercise from the lesson “Binary Search: Conceptual”.

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

Search Algorithms

FAQs on the exercise Time Complexity of Binary Search

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!

I have a question regarding the Big O. One of the requirements of the Binary search is that the list must be sorted (requirement that the linear search doesn’t have). Although I understand that the Big O for the linear search is O(N), meanwhile the binary’s is O(logN), shouldn’t we take into account the sorting of the list in the Binary’s Big O? Intuitively I could see why we shouldn’t if we are working only with one list (as once sorted you don’t need to do it anymore), but in an array, where we could potentially search information given different criteria (and therefore need to sort again for those criteria), it would matter, or not?

Thank you for the reply!

1 Like

Well, consider that in a lot of situations, data is already sorted. this doesn’t work with unsorted lists, and doesn’t need to sort them previosuly.