This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: 1 ICS 141: Discrete Mathematics I (Spr 2008) University of Hawaii ICS141: Discrete Mathematics for Computer Science I Department of Information and Computer Sciences University of Hawaii Stephen Y. Itoga 2 ICS 141: Discrete Mathematics I (Spr 2008) University of Hawaii Lecture 13 Chapter 3. The Fundamentals 3.2 The Growth of Functions 3.3 Complexity of Algorithms 3 ICS 141: Discrete Mathematics I (Spr 2008) University of Hawaii • Some material in these slides were taken/adapted from the slides made by Prof. Michael P. Frank and Prof. Jonathan L. Gross which are provided through the publisher of “Discrete Mathematics and Its Applications” written by Kenneth H. Rosen. • Some slides were done by Prof. Baek 4 ICS 141: Discrete Mathematics I (Spr 2008) University of Hawaii Review: BigO Notation • Let f and g be functions R (or Z ) → R . • Definition: “ f is bigO of g ” (or “ f is in the class O( g )”) if 5 C , k such that f ( x ) ≤ Cg ( x ) 2200 x ≥ k . – “Beyond some point k , function f is at most a constant C times g ( i.e., proportional to g ).” – f is bounded from above by g • “f is at most order g ”, or “f is O( g ) ( f is bigoh of g ) ”, or “ f = O( g )” all just mean that f ∈ O( g ). • Often the phrase “at most” is omitted. • The constants C and k are called witnesses to the relationship f ( x ) is O( g ( x )). 5 ICS 141: Discrete Mathematics I (Spr 2008) University of Hawaii Review:BigO and Polynomials • Theorem 1 : Let f ( x ) = a n x n + a n 1 x n 1 +···+ a 1 x + a (i.e. f ( x ) is a polynomial of degree n ), where a , a 1 ,..., a n 1 , a n are real numbers. Then f ( x ) is O( x n ). – Proof : Using the triangle inequality ( a + b ≤ a + b ), if x ≥ 1 we have  f ( x ) =  a n x n +a n1 x n1 + ⋯ +a 1 x+a  ≤  a n  x n +  a n1  x n1 + ⋯ +  a 1  x+  a  = x n ( a n  +  a n1 / x+ ⋯ +  a 1 / x n1 +  a / x n ) ≤ x n ( a n  +  a n1  + ⋯ +  a 1  +  a ). – This shows that  f ( x )≤ Cx n , where C =  a n  +  a n1  + ⋯ +  a 1  +  a  whenever x ≥ 1. – Hence, f ( x ) is O ( x n ). 6 ICS 141: Discrete Mathematics I (Spr 2008) University of Hawaii Examples • 1 + 2 + ··· + n ≤ n + n + ··· + n + n = n 2 . It follows that 1 + 2 + ··· + n is O( n 2 ) , taking C = 1 and k = 1 as witnesses. • n! = 1 2 3 ⋅ ⋅ ⋅⋯⋅ n ≤ n ⋅ n ⋅ n ⋅⋯⋅ n = n n ∴ n! is O ( n n ) • log n! ≤ log n n = n log n ∴ log n! is O ( n log n ) • n ≤ 2 n whenever n is a positive integer n n n n n i n n i 2 1 2 1 2 ) 1 ( 2 1 2 1 + = + = = + + + ∑ = : Note 7 ICS 141: Discrete Mathematics I (Spr 2008) University of Hawaii Order of Growth of Functions A Display of the Growth of Functions Commonly Used in BigO Estimates • Important complexity classes O(1) ⊂ O(log n ) ⊂ O( n ) ⊂ O( n log n ) ⊂ O( n 2 ) ⊂ O( c n ) ⊂ O( n !) 8 ICS 141: Discrete Mathematics I (Spr 2008) University of Hawaii...
View
Full
Document
This note was uploaded on 09/12/2008 for the course ICS 141 taught by Professor Idk during the Fall '08 term at Hawaii.
 Fall '08
 IDK

Click to edit the document details