The scan invariant
- Before probe , no element of equals the target.
- Each probe either finds the target or extends the scanned prefix by one element.
- The invariant needs no ordering — any sequence of values will do.
no single author
verifiedScan one element at a time until the key appears.
Linear search walks the array from left to right, comparing each element with the target until it matches or the array ends. It needs no ordering and no preprocessing, so it is the baseline every faster search is measured against: its cost is proportional to how far the target sits from the front.
▍ Linear Search · small
requesting trace
· decoding trace
· replaying events
· mounting renderer