This preview shows pages 1–6. Sign up to view the full content.
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 Document
Unformatted text preview: Complexity of algorithms Discrete Math MATH 135 David Oury Introduction BigO/ Ω / Θ Definitions Examples Theorems Exercises Algorithms & complexity Introduction Search Sort Exercises Recursion Exercises Complexity of algorithms Discrete Math MATH 135 David Oury November 3, 2011 Chapter 3, Sections 1, 2, 3 (5 lectures) of Discrete Mathematics and its Applications, by Rosen Complexity of algorithms Discrete Math MATH 135 David Oury Introduction BigO/ Ω / Θ Definitions Examples Theorems Exercises Algorithms & complexity Introduction Search Sort Exercises Recursion Exercises Introduction Goals 1 Define the “bigO/ Ω / Θ ” notations for comparing functions based on the rate at which they increase 2 Compare certain functions 3 Understand theorems to aid in comparison 4 Read and write procedures using operations (atomic and control flow) 5 Count atomic operations required for a procedure to complete “in the worst case” 6 Describe the complexity of procedures using this notation. Complexity of algorithms Discrete Math MATH 135 David Oury Introduction BigO/ Ω / Θ Definitions Examples Theorems Exercises Algorithms & complexity Introduction Search Sort Exercises Recursion Exercises Definition: bigO, big Ω & big Θ I Let f and g be functions R → R or Z → R . Definition: bigO We write f = O ( g ( x )) and say “ f is bigO of g ” when there are constants C and k such that  f ( x )  ≤ C  g ( x )  if x > k . “ f grows more slowly then some fixed multiple of g ” ∃ C ∃ K ∀ x ( K < x →  f ( x )  ≤ C ·  g ( x )  ) Use this to understand the negation, when f is not O ( g ) . Definition: big Ω We write f = Ω( g ( x )) and say “ f is big Ω of g ” when there are constants C and k such that C  g ( x )  ≤  f ( x )  if x > k . “ f grows more quickly then some fixed multiple of g ” Complexity of algorithms Discrete Math MATH 135 David Oury Introduction BigO/ Ω / Θ Definitions Examples Theorems Exercises Algorithms & complexity Introduction Search Sort Exercises Recursion Exercises Definition: bigO, big Ω & big Θ II Definition: big Θ We write f = Θ( g ( x )) and say “ f is big Θ of g ” or that “ f is the order of g ” when f = O ( g ( x )) and f = Ω( g ( x )) . Complexity of algorithms Discrete Math MATH 135 David Oury Introduction BigO/ Ω / Θ Definitions Examples Theorems Exercises Algorithms & complexity Introduction Search Sort Exercises Recursion Exercises Examples: bigO, big Ω & big Θ I Example: ∑ n i =1 i = O ( n 2 ) 1 Notice that ∑ n i =1 i = n ( n + 1) / 2 = n 2 / 2 + n/ 2 . 2 Then n 2 / 2 + n/ 2 ≤ n 2 / 2 + n 2 / 2 = n 2 for n ≥ 1 . 3 Then ∑ n i =1 i = O ( n 2 ) by k = 1 and C = 1 ....
View
Full
Document
This note was uploaded on 02/11/2012 for the course MATH 135 taught by Professor Dr.oury during the Spring '12 term at MO St. Louis.
 Spring '12
 Dr.Oury
 Math

Click to edit the document details