Introduction
Finding a specific item in a list can be tricky if the list is long. Searching algorithms help us quickly locate what we want without checking every single item blindly.
Imagine looking for a word in a dictionary. You don't check every page from the start. Instead, you open near the middle, see if the word is before or after, then open halfway in that section, repeating until you find the word.
List: [2, 4, 6, 8, 10, 12, 14] Linear Search: Start → 2 → 4 → 6 → 8 → ... until target found Binary Search: Step 1: Check middle (8) Step 2: Target < 8? Search left half [2,4,6] Step 3: Check middle (4) Step 4: Target > 4? Search right half [6] Step 5: Check 6 → Found or not