Why does Big O only need its bound to hold past some crossover point, and why is that freedom also its biggest weakness?
Short drills on what this video just taught. Write the code, run the checks, and reveal the answer only if you are stuck.
f is already defined as the video's count, . A line with a big enough c starts out above it, and the video claims no constant keeps it there. Define first_below(c) that steps x up from 1 and returns the first whole number at which c * x is below f(x).
def f(x):
return 3 * x ** 2 + 20 * x + 1Order of growth as the aim of the analysis
State that the aim is to describe how runtime grows with input size, keeping only the fastest-growing term and dropping additive and multiplicative constants, and call what remains the order of growth.
The worked example
Compare with , , and , find the first staying above beyond a crossover near , and record that its dip below near the origin is irrelevant.
The formal definition of
State the definition with constants and , check it for , by computing the crossover and the first integer beyond it, then write , not .
Faster-growing functions as looser upper bounds
Record that , and also satisfy the definition for , and name this looseness as the weakness of big O.