Chapter 7: Time Complexity

For Your Enjoyment


Chapter 7.1, Measuring Complexity

Time Complexity

Big-O Definition

Let f and g be functions f, g: ℕ → ℝ+. Say that f(n) = O(g(n)) if positive integers c and n0 exist such that for every integer n ≥ n0,

                  f(n) ≤ c * g(n)

When f(n) = O(g(n)), we say that g(n) is an upper bound for f(n), or more precisely, that g(n) is an asymptotic upper bound for f(n), to emphasize that we are suppressing constant factors.

Small-O Definition

Let f and g be functions f, g: ℕ → ℝ+. Say that f(n) = o(g(n)) if

          limn → ∞ (f(n) / g(n)) = 0

In other words, f(n) = o(g(n)) means that for any real number c > 0, a number n0 exists, where f(n) < c * g(n) for all n ≥ n0.

Time Complexity Measures

Time Complexity Class Definition

Let t: ℕ → ℝ+ be a function. Define the time complexity class, TIME(t(n)), to be the collection of all languages that are decidable by an O(t(n)) Turing Machine.

Application

Complexity Relations Among Models

Test Your Comprehension

  1. Exercise 7.1, parts b and d. Justify your answer by using the definition of Big-O to identify values for c and n0.
  2. Exercise 7.2, parts b, c and e. Justify your answer by showing the limit mentioned in the definition of Small-O.
  3. Exercise 7.5.

In-Class Notes


Valid XHTML 1.0!