This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: 1 CMPS 101 Summer 2009 Homework Assignment 2 Solutions 1. (1 Point) p.50: 3.11 Let ) ( n f and ) ( n g be asymptotically nonnegative 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 nonnegative, there exists a positive constant n such that ) ( n f and ) ( n g for all n n . For such n we have )) ( ), ( max( 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 n n we have )) ( ), ( max( 2 ) ( ) ( )) ( ), ( max( 1 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.13 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...
View
Full
Document
 Spring '09
 AgoreBack

Click to edit the document details