{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

COT5407-Class02

COT5407-Class02 - BigOhNotation 10,000 Givenfunctionsf(n...

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

Analysis of Algorithms 1 ©  2004 Goodrich, Tamassia Big-Oh Notation Given functions  f ( n ) and  g ( n ) , we say that  f ( n ) is  O ( g ( n ))  if there are  positive constants c  and  n 0  such that f ( n )     cg ( n ) for  n   n 0 Example:  2 n + 10  is  O ( n ) 2 n + 10   cn ( c - 2) n 10 n 10 / ( c - 2) Pick  c = 3 and  n 0 = 10 1 10 100 1,000 10,000 1 10 100 1,000 n 3n 2n+10 n

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

View Full Document
Analysis of Algorithms 2 ©  2004 Goodrich, Tamassia Big-Oh Example Example: the function  n 2 is not  O ( n ) n 2   cn n   c The above inequality  cannot be satisfied  since  c  must be a  constant  1 10 100 1,000 10,000 100,000 1,000,000 1 10 100 1,000 n n^ 2 100n 10n n
Analysis of Algorithms 3 ©  2004 Goodrich, Tamassia More Big-Oh Examples 7n-2 7n-2 is O(n) need c > 0 and n 0    1 such that 7n-2   c•n for n   n 0 this is true for c = 7 and n 0  = 1 3n 3  + 20n 2  + 5 3n 3  + 20n 2  + 5 is O(n 3 ) need c > 0 and n 0    1 such that 3n 3

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 6

COT5407-Class02 - BigOhNotation 10,000 Givenfunctionsf(n...

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

View Full Document
Ask a homework question - tutors are online