Describe growth, not a finish time
Big O notation describes an asymptotic upper bound on how a resource requirement grows with input size. In everyday algorithm discussions, the resource is often time measured through a chosen operation count. It can also be memory. A bound needs an input-size definition and a cost model. It is not a promise about milliseconds on a particular machine.
Harvard’s algorithm notes introduce common growth rates using searching and sorting. The notation helps compare scaling behavior while leaving hardware and implementation details for separate analysis.
Compare two original counting examples
Imagine checking whether a list contains a duplicate identifier. A simple method compares each identifier with every later identifier. If every pair is checked, n identifiers require n(n - 1)/2 pair comparisons. A version that stops after finding a duplicate can do less work on some inputs. With 10 identifiers that is 45 comparisons. With 100 it is 4,950. The leading growth is quadratic, so the method has an O(n squared) comparison bound.
Another method first organizes the data using a suitable sorting algorithm and then checks adjacent identifiers. Its behavior depends on the sorting method and the cost of comparing identifiers. This illustrates an important habit: count all the steps, including preparation. Do not compare only the adjacent-check loop with the complete pairwise procedure.
Constants still matter
Suppose two illustrative operation-count formulas are 30n and n squared. At n equal to 10, they give 300 and 100. At n equal to 100, they give 3,000 and 10,000. The linear expression eventually grows more slowly, but it is not smaller at every input size.
These formulas are invented arithmetic examples, not measurements of two programs. Real constants can reflect allocation, data conversion, function calls, or expensive comparisons. Big O intentionally suppresses fixed multiplicative factors when describing asymptotic growth. Engineering decisions cannot always suppress them when the actual workload is small.
State which case you mean
A linear search that checks items one by one may find its target immediately, or it may inspect the entire list. Best-case, average-case, and worst-case statements answer different questions. An average-case result needs assumptions about the input distribution. A worst-case bound does not claim that every input takes that much work.
Big O is an upper bound, so it can be loose. A linear function is also bounded above by a quadratic function for sufficiently large n. When someone says a procedure “is O(n),” they usually intend an informative growth bound, but a careful analysis should state the case and the resource. Theta notation expresses a matching asymptotic upper and lower growth bound.
The model determines the unit
MIT’s cost-model notes explicitly connect operations to their costs. Treating a fixed-width integer comparison as constant work is useful in one model. Comparing arbitrarily long strings may require examining many characters. A lookup described in terms of record count can conceal a second variable, such as key length.
For a practical review, write down the input dimensions, count the dominant operations, and identify assumptions about data access. Then test representative sizes and measure elapsed time. If the measured curve surprises you, investigate rather than replacing it with the theoretical formula.
Big O is most valuable when it reveals work that will become untenable as data grows. It does not certify correctness, reliability, or measured efficiency. Continue with binary search for logarithmic narrowing, or algorithm and hardware choices for the relationship between growth and execution speed.