lec2 - ( n )), implying f ( n ) is O ( g ( n )) constant f...

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

View Full Document Right Arrow Icon
Rule of the game Our Question: can we do “better”? What is “better”? Less running time Less space usage How to measure? Asymptotic notation In Which Environment? RAM model: our virtual computer * Random memory access 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
* All memory accesses are the same, done in constant time * This is not a real computer How we program? Pseudocode No worry about syntax details Looks like Java code Implementable by programmers (like you) 2
Background image of page 2
Asymptotic Notations and Definitions Assume f ( n ) and g ( n ) are functions from the non-negative real numbers to the non-negative real numbers. We define: Notation Definition f ( n ) is c > 0 and n 0 > 0, O ( g ( n )) s.t. ( n n 0 )( f ( n ) cg ( n )) f ( n ) is c > 0 and n 0 > 0, Ω( g ( n )) s.t. ( n n 0 )( f ( n ) cg ( n )) f ( n ) is f ( n ) is O ( g ( n )) and = Θ( g ( n )) f ( n ) is Ω( g ( n )) f ( n ) is c > 0 , n 0 > 0 < o ( g ( n )) s.t. ( n n 0 )( f ( n ) < cg ( n )) f ( n ) is c > 0 , n 0 > 0 > ω ( g ( n )) s.t. ( n n 0 )( f ( n ) > cg ( n )) Some examples 3
Background image of page 3

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

View Full DocumentRight Arrow Icon
Prove Using Limits We compute lim n →∞ f ( n ) g ( n ) Value Asymptotic bound 0 f ( n ) is o ( g
Background image of page 4
Background image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ( n )), implying f ( n ) is O ( g ( n )) constant f ( n ) is ( g ( n ), implying f ( n ) is O ( g ( n )) and ( g ( n )) f ( n ) is ( g ( n )), implying f ( n ) is ( g ( n )) Some examples 4 Useful Math Formulae Logorithmic x = log a b a x = b log a b = log c a log c b a log b c = c log b a log a +log b = log ( ab );log a-log b = log a b log( a b ) = b log a Series and Summation n i =1 i = n ( n +1) 2 n-1 i =0 q i = 1-q n 1-q (Geometric series) n i =1 1 i is O (log n ) (Harmonic series) LHopital rule (our commonly used version) If lim n f ( n ) = lim n g ( n ) = Then lim n f ( n ) g ( n ) = lim n f ( n ) g ( n ) 5...
View Full Document

Page1 / 5

lec2 - ( n )), implying f ( n ) is O ( g ( n )) constant f...

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

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