{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

02-asymp - Asymptotic Notation Review of Functions...

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

View Full Document Right Arrow Icon
March 26, 2014 Comp 122, Spring 2004 Asymptotic Notation, Review of Functions & Summations Asymptotic Notation, Review of Functions & Summations
Background image of page 1

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

View Full Document Right Arrow Icon
Comp 122 ymp - 2 Asymptotic Complexity Running time of an algorithm as a function of input size n for large n . Expressed using only the highest-order term in the expression for the exact running time. Instead of exact running time, say Θ ( n 2 ). Describes behavior of function in the limit. Written using Asymptotic Notation .
Background image of page 2
Comp 122 ymp - 3 Asymptotic Notation Θ , O , , o , ϖ Defined for functions over the natural numbers. Ex: f ( n ) = Θ ( n 2 ). Describes how f ( n ) grows in comparison to n 2 . Define a set of functions; in practice used to compare two function sizes. The notations describe different rate-of-growth relations between the defining function and the defined set of functions.
Background image of page 3

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

View Full Document Right Arrow Icon
Comp 122 ymp - 4 Θ -notation Θ ( g ( n )) = { f ( n ) : 5 positive constants c 1 , c 2 , and n 0, such that 2200 n n 0 , we have 0 c 1 g ( n ) f ( n ) c 2 g ( n ) } For function g ( n ), we define Θ ( g ( n )), big-Theta of n , as the set: g ( n ) is an asymptotically tight bound for f ( n ). Intuitively : Set of all functions that have the same rate of growth as g ( n ).
Background image of page 4
Comp 122 ymp - 5 Θ -notation Θ ( g ( n )) = { f ( n ) : 5 positive constants c 1 , c 2 , and n 0, such that 2200 n n 0 , we have 0 c 1 g ( n ) f ( n ) c 2 g ( n ) } For function g ( n ), we define Θ ( g ( n )), big-Theta of n , as the set: Technically, f ( n ) Θ ( g ( n )). Older usage, f ( n ) = Θ ( g ( n )). I’ll accept either… f ( n ) and g ( n ) are nonnegative, for large n .
Background image of page 5

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

View Full Document Right Arrow Icon
Comp 122 ymp - 6 Example 10 n 2 - 3 n = Θ ( n 2 ) What constants for n 0 , c 1 , and c 2 will work? Make c 1 a little smaller than the leading coefficient, and c 2 a little bigger. To compare orders of growth, look at the leading term. Exercise: Prove that n 2 /2-3 n = Θ ( n 2 ) Θ ( g ( n )) = { f ( n ) : 5 positive constants c 1 , c 2 , and n 0 , such that 2200 n n 0 , 0 c 1 g ( n ) f ( n ) c 2 g ( n ) }
Background image of page 6
Comp 122 ymp - 7 Example Is 3 n 3 Θ ( n 4 ) ?? How about 2 2 n Θ (2 n )?? Θ ( g ( n )) = { f ( n ) : 5 positive constants c 1 , c 2 , and n 0 , such that 2200 n n 0 , 0 c 1 g ( n ) f ( n ) c 2 g ( n ) }
Background image of page 7

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

View Full Document Right Arrow Icon
Comp 122 ymp - 8 O -notation O ( g ( n )) = { f ( n ) : 5 positive constants c and n 0, such that 2200 n n 0 , we have 0 f ( n ) c g ( n ) } For function g ( n ), we define O ( g ( n )), big-O of n , as the set: g ( n ) is an asymptotic upper bound for f ( n ). Intuitively : Set of all functions whose rate of growth is the same as or lower than that of g ( n ).
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}