Hands-on Tutorial
How Come the Binary Search Becomes the Fastest Searching Algorithm — 1000 Times Faster than Linear Search
Understand the manual calculation of binary search and its implementation using Python
After reading this article, you will understand the comparison between linear search and binary search algorithms, how to perform searching tasks using linear and binary search algorithms, and why binary search is known as the fastest searching algorithm.
To illustrate the mechanism of the searching algorithm, a detailed illustration is made. It aims to help you understand the idea behind binary search algorithms.
Keep reading and enjoy exploring the programming world!
Searching problem
In programming, a lot of algorithms need to perform a searching task. For instance, to compare elements between two lists, we must check the element one by one — it means we need a searching task. When the data becomes bigger and bigger, we must include runtime as a cost.
Imagine, we have 10 random numbers as follows.