The Sets O(g), Θ(g), Ω(g)

  • Let f and g be a functions from the non-negative integers into the positive real numbers
  • For some real constant c > 0 and some non-negative integer constant n0
    • O(g) is the set of functions f, such that:
      • f(n) c * g(n) for all nn0
    • Ω(g) is the set of functions f, such that:
      • f(n) c * g(n) for all nn0
    • Θ(g) = O(g) ∩ Ω(g)
      • Θ(g) is the asymptotic order of g or the order of g

Big-Oh Examples

f(n) ∈ O(g(n)) means that there are positive constants c and n0 such that f(n) ≤ c*g(n) for all values nn0

 
  • Is n ∈ O(n2)?
    • Yes, c = 1, n0 = 2 works fine
  • Is 10n ∈ O(n)?
    • Yes, c = 11, n0 = 2 works fine
  • Is n2 ∈ O(n)?
    • No; no matter what values for c and n0 we pick, n2 > c*n for big enough n

Given f ∈ O(h) and g ∉ O(h),
which of these are true?

  1. For all positive integers m, f(m) < g(m).
  2. For some positive integer m, f(m) < g(m).
  3. For some positive integer m0, and all positive integers m > m0, f(m) < g(m).
  4. 1 and 2
  5. 2 and 3
  6. 1 and 3

Another Way to Define Order Classes

  • Comparing f(n) and g(n) as n approaches infinity...
  • If limit as n approaches infinity of f(n)/g(n) is:
    • < ∞, including the case in which the limit is 0, then f ∈ O(g)
    • > 0, including the case in which the limit is ∞, then f ∈ Ω(g)
    • = c and 0 < c < ∞ then f ∈ Θ(g)
    • = 0 then f ∈ o(g)
      • read as "little-oh of g"
    • = ∞ then f ∈ ω(g)
      • read as "little-omega of g"