T 0 cg n f n n n0 fn is bounded below by gn fn f

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: n) f(n) f ( n ) = O( g( n )) ≈ f ( n) ≤ g ( n) O(n 2 ) : n 2 , n 2 + n,10000n 2 + 999n n, n /1000, n1.99999 , n 2 / lg lg lg n n n0 NCKU IIM NCKU 資料結構 Chapter 3 資料結構 6 Asymptotic Lower Bound Ω( g (n)) = { f (n) | ∃c > 0, n0 >0 s.t. 0 ≤ cg (n) ≤ f (n) ∀n ≥ n0 } f(n) is bounded below by g(n), f(n) f ( n ) = Ω( g( n )) ≈ f ( n) ≥ g ( n) cg(n) Ω(n 2 ) : n 2 , n 2 + n,10000n 2 + 999n n3 , n 2.00001 , n 2 lg lg lg n, 2n n n0 NCKU IIM NCKU 資料結構 Chapter 3 資料結構 7 Properties Thm f (n) = O( g (n)) ⇔ g (n) = Ω( f (n)) ⎧ f (n) = O( g (n)) f (n) = Θ( g (n)) ⇔ ⎨ ⎩ f (n) = Ω( g (n)) ‧In general p ( n ) = ∑ i = 0 ai n i where ai are constant with ad > 0. d Then p ( n) = Θ(n d ). NCKU IIM NCKU 資料結構 Chapter 3 資料結構 8 Example of Θ Show that ¼ n3 + 4n2 + 24 is Θ(n3). By definition, we must show that c1 n3 ≤ ¼ n3 + 4n2 + 24 ≤ c2 n3 (1) Divide both sides by n3 to get c1 ≤ ¼ + 4/n + 24/n3 ≤ c2 (2) 1. Notice that for any n ≥ 0, equation (2) will never go below ¼. So pick c1 = ¼. Here, we have shown (1) is (1) Ω(n3). 2. Now see that, for n = 1, rhs of (2) reduces to ¼ + 4 + 24 < 29, which is an upper bound for n ≥ 1. So pick c2 =29 and n0 =1. This shows that (1) is Ο(n3). (1) 3. By thm 3.1, ¼ n3 + 4n2 + 24 is Θ(n3). NCKU IIM NCKU 資料結構 Chapter 3 資料結構 9 Asymptotic Notation in Equations • When on rhs: O(n 2 ) stands for some anoymous function in the set O(n 2 ) 2n 2 + 3n + 1 = 2n 2 + Θ(n) means ∃f (n) ∈ Θ(n) such that 2n 2 + 3n + 1 = 2n 2 + f (n) • When on lhs: no matter how the anonymous functions are chosen on the lhs, there is a way to choos...
View Full Document

This note was uploaded on 02/08/2013 for the course SCI 399 taught by Professor Bob during the Winter '12 term at Bismarck State College.

Ask a homework question - tutors are online