2 ex log10 n log 10 log2 n base of logarithm is not

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: f(n) = O(h(n)) f(n) = Ω (g(n)) & g(n) = Ω (h(n)) ⇒ f(n) = Ω (h(n)) f(n) = o (g(n)) & g(n) = o (h(n)) ⇒ f(n) = o (h(n)) f(n) = ω(g(n)) & g(n) = ω(h(n)) ⇒ f(n) = ω(h(n)) Reflexivity f(n) = Θ(f(n)) f(n) = O(f(n)) f(n) = Ω (f(n)) mp - 21 Comp 122 Properties Symmetry f(n) = Θ(g(n)) iff g(n) = Θ(f(n)) Complementarity f(n) = O(g(n)) iff g(n) = Ω (f(n)) f(n) = o(g(n)) iff g(n) = ω((f(n)) mp - 22 Comp 122 Common Functions March 26, 2014 Comp 122, Spring 2004 Monotonicity f(n) is mp - 24 monotonically increasing if m ≤ n ⇒ f(m) ≤ f(n). monotonically decreasing if m ≥ n ⇒ f(m) ≥ f(n). strictly increasing if m < n ⇒ f(m) < f(n). strictly decreasing if m > n ⇒ f(m) > f(n). Comp 122 Exponentials Useful Identities: 1 a= a (a m ) n = a mn −1 a m a n = a m+ n Exponentials and polynomials nb lim n = 0 n→∞ a ⇒ n b = o( a n ) mp - 25 Comp 122 Logarithms x = logba is the exponent for a = bx. a = b logb a log c (ab) = log c a + log c b log b a = n log b a n Natural log: ln a = logea Binary log: lg a = log2a lg2a = (lg a)2 lg lg a = lg (lg a) log c a log b a = log c b log b (1 / a ) = − log b a 1 log b a = log a b a logb c = c logb a mp - 26 Comp 122 Logarithms and exponentials – Bases If the base of a logarithm is changed from one constant to another, the value is altered by a constant factor. Ex: log10 n * log210 = log2 n. Base of logarithm is not an issue in asymptotic notation. Exponentials with different bases differ by a exponential factor (not a constant factor). Ex: 2n = (2/3)n*3n. mp - 27 Comp 122 Polylogarithms For a ≥ 0, b > 0, lim n→∞ ( lga n / nb ) = 0, so lga n = o(nb), and nb = ω(lga n ) Prove using L’Hopital’s rule repeatedly lg(n!) = Θ(n lg n) Prove using Stirling’s approximation (in the text) for lg( n!). mp - 28 Comp 122 Exercise Express functions in A in asymptotic notation using functions in B. A 5n2 + 100n B 3n2 + 2 A ∈ Θ (B) A ∈ Θ(n2), n2 ∈ Θ(B) ⇒ A ∈ Θ(B) log3(n2) log2(n3) A ∈ Θ (B) logba = logca / logcb; A = 2lgn / lg3, B = 3lgn, A/B =2/(3lg3) A ∈ ω (B) nlg4 3lg n alog b = blog a; B =3lg n=nlg 3; A/B =nlg(4/3) →∞ as n→∞ A ∈ ο (B) lg2n n1/2 lim ( lga n / nb ) = 0 (here a = 2 and b = 1/2) ⇒ A ∈ ο (B) n→∞ mp - 29 Comp 122 Summations – Review March 26, 2014 Comp 122, Spring 2004 Review on Summations Why do we need summation formulas? For computing the running times of iterative constructs (loops). (CLRS – Appendix A) Example: Maximum Subvector Given an array A[1…n] of numeric values (can be positive, zero, and negative) determine the subvector A[i…j] (1≤ i ≤ j ≤ n) whose sum of elements is maximum over all subvectors. 1 mp - 31 -2 2 Comp 122 2 Review on Summations MaxSubvector(A, n) maxsum ← 0; for i ← 1 to n do for j = i to n sum ← 0 for k ← i to j do sum += A[k] maxsum ← max(sum, maxsum) return maxsum...
View Full Document

Ask a homework question - tutors are online