Searching Algorithms in Python
Linear search walks left to right — works on any list, O(n). Binary search cuts half each time — list must be sorted, O(log n).
If they say binary search, first sentence is “sorted”. Unsorted binary search is wrong.
Searching Algorithms in Python — output — True then 1. Linear membership. Binary search needs a sorted list.
Exam tip
Linear vs binary: sorted or not + complexity.