Concept Flow - Binary Search vs Linear Search Real Cost Difference
Start at index 0
Check element == target?
No→Move to next index
End: Not found
Return index
Start with low=0, high=n-1
Calculate mid = (low+high)/2
Check element at mid == target?
Return
Repeat until low > high
Return not found
Linear search checks each element one by one from start to end. Binary search divides the search range in half each step, quickly narrowing down the target location.
