The idea
Key formulas
Best-case count
Loading lessons…
Just a moment, getting everything ready. The first load can take up to a minute.
Data structures and algorithms
Compare linear search and insertion sort across favorable, unfavorable, seeded random, and adversarial inputs.
Best-case work occurs on favorable inputs; worst-case work is the maximum for an input size. Average-case analysis takes an expectation over a stated input distribution. The seeded random case makes experiments repeatable, while adversarial arrangements expose poor behavior.