{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

hw2solns - CMPS 101 Summer 2009 Homework Assignment 2...

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

View Full Document Right Arrow Icon
1 CMPS 101 Summer 2009 Homework Assignment 2 Solutions 1. (1 Point) p.50: 3.1-1 Let ) ( n f and ) ( n g be asymptotically non-negative functions. Using the basic definition of Θ - notation, prove that ))) ( ), ( (max( ) ( ) ( n g n f n g n f Θ = + . Proof: Since ) ( n f and ) ( n g are asymptotically non-negative, there exists a positive constant 0 n such that 0 ) ( n f and 0 ) ( n g for all 0 n n . For such n we have )) ( ), ( max( 0 n g n f )) ( ), ( max( )) ( ), ( min( n g n f n g n f + )) ( ), ( max( 2 n g n f . But )) ( ), ( max( )) ( ), ( min( ) ( ) ( n g n f n g n f n g n f + = + , so for all 0 n n we have )) ( ), ( max( 2 ) ( ) ( )) ( ), ( max( 1 0 n g n f n g n f n g n f + . Thus ))) ( ), ( (max( ) ( ) ( n g n f n g n f Θ = + , as required. /// 2. (1 Point) p.50: 3.1-3 Explain why the statement “The running time of algorithm A is at least ) ( 2 n O ” is meaningless. Solution: This statement is true under all circumstances, hence it conveys no useful information, and is therefore meaningless. To illustrate, let ) ( n T be the running time of algorithm A. To say that ) ( n T is “at least ) ( 2 n O ” is to say that ) ( n T is bounded below by a function which is bounded above (asymptotically) by 2 n . If ) ( n T in the class ) ( 2 n O , then ) ( n T is bounded below by itself, which is bounded above asymptotically by 2 n , and hence the statement is true. If on the other hand, ) ( n T is in the class ) ( 2 n Ω , then ) ( n T is bounded below by 2 cn (for sufficiently large n ), which is bounded above asymptotically by 2 n , and again the statement is true. Even if ) ( n T is not comparable to 2 n , ) ( n T is bounded below by some positive constant, which is bounded above by 2 n . (This is true since even if
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
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}