In differential testing, two programs run on the same inputs…

In differential testing, two programs run on the same inputs and must agree: the clever algorithm under test, and a reference program called the oracle. For searching a rack, the slow linear scan — it simply examines every slip — serves as the oracle, rather than the clever algorithm. What makes the slow program the trustworthy side of the comparison?

An unsorted rack holds n slips, and n orders must be deliver…

An unsorted rack holds n slips, and n orders must be delivered. For each order the program runs a linear scan of the rack, checking slips one by one: for t in orders: # n orders scan(rack, t) # checks up to n slips Counting how often the innermost operation runs, the total running time is: