Solution_hw1

# Solution_hw1 - Solutions for Homework 1 problems 1 = 2 =...

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Solutions for Homework 1 problems 1. = 2 ) = ( log )( = = 3 (log ) = 2( =2 Claim: Pf: = ) . (n) = ( log )( ∈( lim ∈( ∈( ) : note, → () () ) =2 (( )( ) ) = 2( )= → )( ) = ( )= 2 = lim = () () )( = (2 = lim → =0 ): Since ): lim ( ) ( → = = lim )( → ( ) = lim → ( ( )( ) ) ( ) = lim → ) → =0 ( ( ) ) ∈( lim → ( ): lim . → () () = lim ( . ) = lim → ( . ) = ) =0 → () () ∈( lim → ( ): lim . ) = lim → ( ) . = lim → . ( ) = =0 2. (a) True PF: (consider the positive part of the functions) f(n) + g(n) ≤ 2 max {f(n), g(n)} => f(n) + g(n) ∈ O(max{f(n),g(n)}) Max{f(n) + g(n)} ≤ f(n) + g(n) => max {f(n)+g(n)} ∈ O(f(n) + g(n)) (b) False, for instance, take f(n) = (c) False, for instance, take f(n) = 3n g(n) = 2n s(n) = n + 1 r(n) = n 3. S(n) = log( ) = k n 2t log( 2t k )= ( − )2 = +2 = 2 − 2−2 2= (2 − 1) − ( − 1)2 4. (a) ( )= 2 Let 2 + log (2) = 1 )+ =2 ℎ (2 ) = 2 (2 Define G (k) = T (2 ) → (1) = 1 → ( ) = 2 ( − 1) + … 2 ( − )= 2 2 − ( + 1) + 2 ( − ) … (2) = 2 + − −2 (1) + 2 2 ( )= 2 2 (b) The “+3” can be ignored ( ) = 16 4 + + 2− 2 =2 2 ( − )= ( )= 1 ≤4 Using the Master Theorem (Page 139 of the textbook) = 16 Now, ( ) ∈ ( ), ℎ =4 = log / log = 2 ( )= log ) ( ) ∈ ( ( ) log ) = ( 5. Sort the set S into an array L For each I = 1 … size (A) If BinarySearch(A, X-A[i]) then Return true Return false (1) ( ) ( ) ...
View Full Document

## This note was uploaded on 02/27/2010 for the course ECE 544 taught by Professor Ray during the Spring '10 term at Rutgers.

Ask a homework question - tutors are online