Asymptotic notation lets us compare the growth rates of functions. We drop constants and small terms and keep the essence.
Three notations
O(g)— upper bound:fgrows no faster thang.Ω(g)— lower bound:fgrows no slower thang.Θ(g)— tight bound:fandggrow at the same rate.
The function 3n² + 5n + 7 is O(n²), Ω(n²) and therefore Θ(n²). It is also O(n³), but that is a loose bound.
The formal definition
f(n) = O(g(n))if there existc > 0andn0such thatf(n) ≤ c · g(n)for alln ≥ n0.f(n) = Ω(g(n))if there existc > 0andn0such thatf(n) ≥ c · g(n)for alln ≥ n0.f(n) = Θ(g(n))if bothOandΩhold.
The sign "=" here is not equality but "belongs to the class".