hw2solns - 1 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

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 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 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.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...
View Full Document

Page1 / 4

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

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

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