{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

hw2solutions

To recap we have shown that there exist c 3 = c 1 c 2

Info iconThis preview shows pages 2–4. 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: To recap, we have shown that there exist c 3 = c 1 c 2 and N 3 = max( N 1 ,N 2 ) such that for n ≥ N 3 we have f ( n ) g ( n ) ≤ c 3 h ( n ) k ( n ). Problem 3: 15 points In this problem you are allowed to use results that were proved or even just stated in the lecture notes. Provide a counterexample to show that the following is false : For any(all) two functions f and g that map nonnegative reals to strictly positive reals we have that f ( n ) is O ( g ( n )) implies [ f ( n )] n is O ([ g ( n )] n ). Many other counterexamples were used in the solutions. A typical one was f ( n ) = 2 n and g ( n ) = n (for strictly positive n ; f (0) and g (0) can be whatever you want.). Now [ f ( n )] n = 2 n n n is [ g ( n )] n = n n . While it is true that 2 n n n is not O ( n n ) (so this is a good counterexample) this does not follow directly from what was proved or even just stated in the lecture notes. So those who gave this counterexample were also expected to prove that 2 n n n is not O ( n n ). Here is a proof. Suppose, toward a contradiction, that 2 n n n is O ( n n ). Then, ∃ N,c > 0 s.t. ∀ n ≥ N we have 2 n n n ≤ cn n . Therefore, ∀ n ≥ N we must have 2 n ≤ c and we have a contradiction witnessed by some n that is both bigger than N and strictly bigger than log c . Answer The counterexample is given by the functions f ( n ) = 3 and g ( n ) = 2. From the lecture notes we know that f ( n ) is O ( g ( n )). From the lecture notes we also know that 3 n is not O (2 n ). Problem 4: 20 points In this problem you are NOT allowed to use the theorems about Big-Oh stated in the lecture notes. Your proof should follow just from the definition of Big-Oh. Let a,b be two strictly positive constants let f,g be two functions that map nonnegative reals to strictly positive reals, and let C ( n ) = af ( n ) + bg ( n ) and D ( n ) = max( af ( n ) ,bg ( n )). A. Prove that C ( n ) is O ( D ( n )). Answer Since ∀ n af ( n ) ≤ max( af ( n ) ,bg ( n )) = D ( n ) and bg ( n ) ≤ max( af ( n ) ,bg ( n )) = D ( n ), adding both sides of the inequalities we get that for all nonnegative n (so the functions are defined) we have C ( n ) ≤ 2 D ( n ). Therefore we have have shown that there exist c = 2 and N = 1 (to ensure that N > 0) such that ∀ n ≥ N C ( n ) ≤ cD ( n ). Note Some of the submitted solutions began with a separation into two cases: (1) af ( n ) ≥ bg ( n ) and (2) a,f ( n ) ≤ bg ( n ) and then proceeded to show that C ( n ) is O ( af ( n )) in case (1) and that C ( n ) is O ( bg ( n )) in case (2). Such a solution is not correct because while for fixed n we have that D ( n ) is either af ( n )) or bg ( n )), there is no guarantee that we have the same 2 separation into cases for all n , and in proving C ( n ) is O ( D ( n )) we need to show an inequality for all n ≥ N ....
View Full Document

{[ snackBarMessage ]}

Page2 / 6

To recap we have shown that there exist c 3 = c 1 c 2 and N...

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

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