Linear vs binary search
Watch a sorted list change the number of guesses.
Playback is compressed; model values are shown separately.
Make a prediction
Which uses fewer comparisons for this target?
Ready. Adjust the settings or press Run.
How it works & assumptions
Linear search checks 1 through the target. Binary search halves the inclusive interval using floor((low+high)/2) after each comparison.
Sorted consecutive integers 1…N. Target must be within the list. Comparison counts exclude setup and sorting.
References: CS1110, Lecture 27: Search (Spring 2019)
This is an ideal mathematical model, not a measurement or a forecast.