Binary Search

In the previous module, you learned that an algorithm is a well-defined series of steps for performing a task. Toward the end of the module, you learned a specific type of algorithm called linear search. While linear search can be helpful in some situations, it is sometimes a naive approach to a situation. 

In this module, you'll learn another algorithm — binary search — and improve your knowledge of data structures and algorithms.

As this module progresses, we'll show you how binary search is different from linear search, why it is more efficient, and how to code binary search from scratch. While learning binary search, you will analyze NBA player data.

You'll learn several important concepts such as pseudo-code, binary search, time complexity of binary search, and more.

Learning about algorithms can be tough without any hands-on practice. That's why as you work through each concept, you’ll get to apply what you’ve learned from within your browser — there's no need to use your own machine to do the exercises. The Python environment inside of this course includes answer checking so you can ensure that you've fully mastered each concept.


  • Learn to implement the binary search algorithm.
  • Learn to analyze the time complexity of binary search.

Mission Outline

1. Let's Play a Game
2. A Better Strategy
3. When can we use binary search?
4. Implementing Binary Search: Part 1
5. Implementing Binary Search: Part 2
6. Pseudo-Code
7. Implementing Binary Search: Part 3
8. Implementing Binary Search: Part 4
9. Binary Search Time Complexity Analysis
10. Takeaways


Course Info:


The median completion time for this course is 6.16 hours. ​View Details​​​

This course requires a premium subscription. This course includes five missions, and one guided project. It is the 26th course in the Data Scientist in Python path.


Take a Look Inside

(function(d) { d.addEventListener("DOMContentLoaded", function() { var pathname = d.location.pathname.replace(/^[/]|[/]$/g, "").replace("/", "-"); var tags = d.getElementsByTagName("iframe"); var type = pathname.startsWith("course") ? "?course=" : pathname.startsWith("path") ? "?path=" : null; if (type) { var i; for (i = 0; i < tags.length; i++) { if (tags[i].src.indexOf("signup#iframe") !== -1) { tags[i].src = tags[i].src.replace("#iframe", "") + type + pathname + "#iframe"; } } } }, false); })(document);