SLU MATH135 algorithms

SLU MATH135 algorithms - Complexity of algorithms Discrete...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

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

Unformatted text preview: Complexity of algorithms Discrete Math MATH 135 David Oury Introduction Big-O/ Ω / Θ 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 Big-O/ Ω / Θ Definitions Examples Theorems Exercises Algorithms & complexity Introduction Search Sort Exercises Recursion Exercises Introduction Goals 1 Define the “big-O/ Ω / Θ ” 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 Big-O/ Ω / Θ Definitions Examples Theorems Exercises Algorithms & complexity Introduction Search Sort Exercises Recursion Exercises Definition: big-O, big- Ω & big- Θ I Let f and g be functions R → R or Z → R . Definition: big-O We write f = O ( g ( x )) and say “ f is big-O 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 Big-O/ Ω / Θ Definitions Examples Theorems Exercises Algorithms & complexity Introduction Search Sort Exercises Recursion Exercises Definition: big-O, 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 Big-O/ Ω / Θ Definitions Examples Theorems Exercises Algorithms & complexity Introduction Search Sort Exercises Recursion Exercises Examples: big-O, 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.

Page1 / 31

SLU MATH135 algorithms - Complexity of algorithms Discrete...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online