lecture_02

# lecture_02 - Introduction to Algorithms 6.046J/18.401J...

This preview shows pages 1–10. Sign up to view the full content.

Introduction to Algorithms 6.046J/18.401J Prof. Charles E. Leiserson L ECTURE 2 Asymptotic Notation O -, -, and Θ -notation Recurrences Substitution method Iterating the recurrence Recursion tree Master method

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

View Full Document
September 13, 2004 Introduction to Algorithms L2.2 Asymptotic notation We write f ( n ) = O ( g ( n )) if there exist constants c > 0, n 0 > 0 such that 0 f ( n ) cg ( n ) for all n n 0 . We write f ( n ) = O ( g ( n )) if there exist constants c > 0 , n 0 > 0 such that 0 f ( n ) cg ( n ) for all n n 0 . O -notation (upper bounds): © 2001–4 by Charles E. Leiserson
September 13, 2004 Introduction to Algorithms L2.3 Asymptotic notation We write f ( n ) = O ( g ( n )) if there exist constants c > 0, n 0 > 0 such that 0 f ( n ) cg ( n ) for all n n 0 . We write f ( n ) = O ( g ( n )) if there exist constants c > 0 , n 0 > 0 such that 0 f ( n ) cg ( n ) for all n n 0 . O -notation (upper bounds): E XAMPLE : 2 n 2 = O ( n 3 ) ( c = 1 , n 0 = 2 ) © 2001–4 by Charles E. Leiserson

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

View Full Document
September 13, 2004 Introduction to Algorithms L2.4 Asymptotic notation We write f ( n ) = O ( g ( n )) if there exist constants c > 0, n 0 > 0 such that 0 f ( n ) cg ( n ) for all n n 0 . We write f ( n ) = O ( g ( n )) if there exist constants c > 0 , n 0 > 0 such that 0 f ( n ) cg ( n ) for all n n 0 . O -notation (upper bounds): E XAMPLE : 2 n 2 = O ( n 3 ) functions, not values ( c = 1 , n 0 = 2 ) © 2001–4 by Charles E. Leiserson
September 13, 2004 Introduction to Algorithms L2.5 Asymptotic notation We write f ( n ) = O ( g ( n )) if there exist constants c > 0, n 0 > 0 such that 0 f ( n ) cg ( n ) for all n n 0 . We write f ( n ) = O ( g ( n )) if there exist constants c > 0 , n 0 > 0 such that 0 f ( n ) cg ( n ) for all n n 0 . O -notation (upper bounds): E XAMPLE : 2 n 2 = O ( n 3 ) functions, not values funny, “one-way” equality ( c = 1 , n 0 = 2 ) © 2001–4 by Charles E. Leiserson

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

View Full Document
September 13, 2004 Introduction to Algorithms L2.6 Set definition of O-notation O ( g ( n )) = { f ( n ) : there exist constants c > 0, n 0 > 0 such that 0 f ( n ) cg ( n ) for all n n 0 } O ( g ( n )) = { f ( n ) : there exist constants c > 0 , n 0 > 0 such that 0 f ( n ) cg ( n ) for all n n 0 } © 2001–4 by Charles E. Leiserson
September 13, 2004 Introduction to Algorithms L2.7 Set definition of O-notation O ( g ( n )) = { f ( n ) : there exist constants c > 0, n 0 > 0 such that 0 f ( n ) cg ( n ) for all n n 0 } O ( g ( n )) = { f ( n ) : there exist constants c > 0 , n 0 > 0 such that 0 f ( n ) cg ( n ) for all n n 0 } E XAMPLE : 2 n 2 O ( n 3 ) © 2001–4 by Charles E. Leiserson

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

View Full Document
September 13, 2004 Introduction to Algorithms L2.8 Set definition of O-notation O ( g ( n )) = { f ( n ) : there exist constants c > 0, n 0 > 0 such that 0 f ( n ) cg ( n ) for all n n 0 } O ( g ( n )) = { f ( n ) : there exist constants c > 0 , n 0 > 0 such that 0 f ( n ) cg ( n ) for all n n 0 } E XAMPLE : 2 n 2 O ( n 3 ) ( Logicians: λ n .2 n 2 O ( λ n . n 3 ) , but it’s convenient to be sloppy, as long as we understand what’s really going on.) © 2001–4 by Charles E. Leiserson
September 13, 2004 Introduction to Algorithms L2.9 Macro substitution Convention: A set in a formula represents an anonymous function in the set.

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

View Full Document
This is the end of the preview.