Linear scans to logarithmic jumps — see exactly how each search narrows the field.
16 visualizations
Scans elements one by one until the target is found or the array ends — works on any array.
Repeatedly halves a sorted array, comparing the middle element to the target — O(log n) lookups.
Jumps ahead in fixed √n blocks on a sorted array, then scans the block that must contain the target.
Predicts the target's index by linear interpolation on value — near O(log log n) on uniformly distributed data.
Doubles a range bound until it passes the target, then binary-searches that range — great for unbounded lists.
Divides a sorted range into three parts with two midpoints, discarding two-thirds each step.
Searches a sorted array by shrinking Fibonacci-sized candidate blocks.
Temporarily stores the target at the end so the linear scan needs no bounds check.
Partitions only toward the requested order statistic, averaging linear time.
Runs left- and right-biased binary searches to find the complete target range.
Finds a target by identifying the sorted half of each rotated search interval.
Uses the local slope to locate an element not smaller than its neighbors.
Walks from the top-right corner of a row- and column-sorted matrix.
Computes the first position not below the target and the first position above it.
Orders offline range queries to minimize endpoint movement.
Computes distances and a deterministic nearest-neighbor vote.