Conceptual
Login

Counting an Algorithm's Basic Operations as a Function of Input Size

Deriving a running-time expression T(n) for an algorithm by counting how many basic operations (comparisons, assignments, arithmetic steps) it executes for an input of size n. The mechanism is to read the algorithm's control flow directly: a straight-line block contributes a constant number of operations, a loop contributes its body's cost multiplied by its iteration count, and nested loops multiply. This produces the concrete operation-count function that later analysis abstracts into a growth class, and it is what makes running time a property of the algorithm rather than of the machine it runs on.