Concept Flow - Binary Search vs Linear Search Real Cost Difference
Start at index 0
Check element == target?
No→Move to next index
Yes
Found
Stop
Start with low=0, high=n-1
Calculate mid = (low+high)//2
Check element at mid == target?
If target < mid element
Set high = mid-1
Repeat until low > high
Linear search checks each element one by one until it finds the target or ends. Binary search splits the list and narrows down the search by comparing the middle element repeatedly.
