This preview shows page 1. Sign up to view the full content.
Unformatted text preview: 0, 0 ≤ c1g(n) ≤ f(n) ≤ c2g(n)} Is 3n3 ∈ Θ(n4) ?? How about 22n∈ Θ(2n)?? mp  7 Comp 122 Onotation
For function g(n), we define O(g(n)),
bigO of n, as the set:
O(g(n)) = {f(n) :
∃ positive constants c and n0,
such that ∀ n ≥ n0,
we have 0 ≤ f(n) ≤ cg(n) } Intuitively: Set of all functions
whose rate of growth is the same as
or lower than that of g(n). g(n) is an asymptotic upper bound for f(n).
f(n) = Θ (g(n)) ⇒ f(n) = O(g(n)).
Θ (g(n)) ⊂ O(g(n)).
mp  8
Comp 122 Examples
O(g(n)) = {f(n) : ∃ positive constants c and n0,
such that ∀ n ≥ n0, we have 0 ≤ f(n) ≤ cg(n) } Any linear function an + b is in O(n2). How? Show that 3n3=O(n4) for appropriate c and n0. mp  9 Comp 122 Ω notation
For function g(n), we define Ω (g(n)),
bigOmega of n, as the set:
Ω (g(n)) = {f(n) :
∃ positive constants c and n0,
such that ∀ n ≥ n0,
we have 0 ≤ cg(n) ≤ f(n)} Intuitively: Set of all functions
whose rate of growth is the same
as or higher than that of g(n). g(n) is an asymptotic lower bound for f(n). mp  10 f(n) = Θ (g(n)) ⇒ f(n) = Ω (g(n)).
Θ (g(n)) ⊂ Ω (g(n)).
Comp 122 Example
Ω (g(n)) = {f(n) : ∃ positive constants c and n0, such
that ∀n ≥ n0, we have 0 ≤ cg(n) ≤ f(n)} √n = Ω (lg n). Choose c and n0. mp  11 Comp 122 Relations Between Θ, O, Ω mp  12 Comp 122 Relations Between Θ, Ω , O
Theorem :: For any two functions g((n) and ff(n),
Theorem For any two functions g n) and (n),
ff(n) = Θ ((g(n)) iiff
(n) = Θ g(n)) ff
ff(n) = O((g(n)) and ff(n) = Ω ((g(n)).
(n) = O g(n)) and (n) = Ω g(n)). I.e., Θ(g(n)) = O(g(n)) ∩ Ω (g(n)) In practice, asymptotically tight bounds are
obtained from asymptotic upper and lower bounds. mp  13 Comp 122 Running Times “Running time is O(f(n))” ⇒ Worst case is O(f(n)) O(f(n)) bound on the worstcase running time ⇒
O(f(n)) bound on the running time of every input. Θ(f(n)) bound on the worstcase running time ⇒
Θ(f(n)) bound on the running time of every input. “Running time is Ω (f(n))...
View
Full
Document
This document was uploaded on 03/26/2014.
 Spring '14

Click to edit the document details