AsymptoticGrowth - 1 CMPS 101 Algorithms and Abstract Data...

Info iconThis preview shows pages 1–3. 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 Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 CMPS 101 Algorithms and Abstract Data Types Asymptotic Growth of Functions We introduce several types of asymptotic notation which are used to compare the relative performance and efficiency of algorithms. As we shall see, the asymptotic run time of an algorithm gives a simple machine independent characterization of it’s complexity. Definition Let ) ( n g be a function. The set )) ( ( n g O is defined as } ) ( ) ( : , , | ) ( { )) ( ( n cg n f n n n c n f n g O ≤ ≤ ≥ ∀ > ∃ > ∃ = . In other words, )) ( ( ) ( n g O n f ∈ if and only if there exist positive constants c , and n , such that for all n n ≥ , the inequality ) ( ) ( n cg n f ≤ ≤ is satisfied. We shall say in this case that ) ( n f is Big O of ) ( n g , or that ) ( n g is an asymptotic upper bound for ) ( n f . We often abuse notation slightly by writing )) ( ( ) ( n g O n f = to mean )) ( ( ) ( n g O n f ∈ . Actually )) ( ( ) ( n g O n f ∈ is itself an abuse of notation. We should really write ) ( g O f ∈ since what we have defined is a set of functions, not a set of numbers. The notational convention )) ( ( n g O is useful since it allows us to refer to the set ) ( 3 n O say, without having to introduce a new function symbol for the polynomial 3 n . Observe that if )) ( ( ) ( n g O n f = then ) ( n f is asymptotically non-negative , i.e. ) ( n f is non-negative for all sufficiently large n , and likewise for ) ( n g . We make the blanket assumption from now on that all functions under discussion are asymptotically non-negative. In practice we will be concerned with integer valued functions of a (positive) integer n ( + + → Z Z : g ). However, in what follows, it is useful to consider n to be a continuous real variable taking positive values and g to be real valued function ( + + → R R : g ). Geometrically )) ( ( ) ( n g O n f = says: ) ( n cg ) ( n f n 2 Example ) 300 10 ( 100 40 2 + + = + n n O n . Observe that 300 10 100 40 2 + + ≤ + ≤ n n n for all 20 ≥ n . Thus we may take 20 = n and 1 = c in the definition. 300 10 2 + + n n 300 100 40 + n 100 10 20 In fact ) ( 2 e dn cn O b an + + = + for any constants a- e , and more generally )) ( ( ) ( n q O n p = whenever ) ( n p and ) ( n q are polynomials satisfying ) deg( ) deg( q p ≤ . (See exercises (c) and (d) at the end of this handout.) Definition Let ) ( n g be a function and define the set )) ( ( n g Ω to be } ) ( ) ( : , , | ) ( { )) ( ( n f n cg n n n c n f n g ≤ ≤ ≥ ∀ > ∃ > ∃ = Ω . We say ) ( n f is big Omega of ) ( n g , and that ) ( n g is an asymptotic lower bound for ) ( n f . As before we write )) ( ( ) ( n g n f Ω = to mean )) ( ( ) ( n g n f Ω ∈ . The geometric interpretation is: ) ( n f ) ( n cg n Theorem )) ( ( ) ( n g O n f = if and only if )) ( ( ) ( n f n g Ω = ....
View Full Document

{[ snackBarMessage ]}

Page1 / 8

AsymptoticGrowth - 1 CMPS 101 Algorithms and Abstract Data...

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

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