FREE Algorithms LESSON · Algorithms
Model the workload first
Operations, representations, and honest cost
The input is not the workload.
A useful algorithm begins with the operations the system must support, their frequency, the shape of the input, and the resource that is scarce. A hash table and a balanced tree can both store key–value pairs, but one bets on equality and hashing while the other preserves order. Big-O describes growth under a model; it does not erase cache misses, allocations, adversarial keys, or the actual range of n.
Choose the model that preserves the decision-relevant facts, then make its assumptions visible.
Big-O can be correct and still mislead.
Two linear scans can differ by orders of magnitude when one walks contiguous memory and the other follows pointers across cache lines. A theoretically better structure can lose below a crossover point. The remedy is not to abandon analysis; it is to add the costs the abstraction hid and test the range the product actually occupies.
Asymptotics tell you how growth behaves. A cost model tells you what matters here.