Searching Algorithms
Let's study some famous and important searching algorithms including binary search.
We'll cover the following...
We'll cover the following...
Brute force: linear search
This is the most simple searching algorithm.
How linear search works?
Go through each element one by one. When the element you are searching for is found, return its index. Here are some slides to make things clearer:
Implementation #
The linear search scans one item at a time and traverses the entire list to find the desired element.
Performance of linear search
Linear search runs in ...