This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CS 173: Discrete Structures, Fall 2009 Homework 8 Solutions This homework contains 3 problems worth a total of 30 regular points. 1. More on recurrences [10 points] In the discussion of Karatsuba’s algorithm for multiplying integers (end of lecture 25), I left out some details of the analysis. Let’s fill in some of them: (a) I claimed that if T has the following recurrence (where c and d are constants) T (1) = c T ( n ) = 4 T ( n/ 2) + dn then T is O ( n 2 ). Show that this is true by unrolling the recurrence, assuming that n is a power of two. (b) I claimed that n ( 3 2 ) log 2 n is O ( n log 2 3 ). Show that this is correct. Hint: use algebra and standard properties of logs and exponentials. Solution: (a) Lets assume n = 2 k . T ( n ) = T (2 k ) = 4 T (2 k / 2) + dn = 4(4 T (2 k / 2 2 ) + d (2 k / 2)) + dn = 4 2 T (2 k / 2 2 ) + 2 d 2 k + d 2 k = 4 2 (4 T (2 k / 2 3 ) + d 2 k / 2 2 ) + 2 d 2 k + d 2 k = 4 3 T (2 k / 2 3 ) + 2 2 d 2 k + 2 d 2 k + d 2 k = . . . = 4 k T (2 k / 2 k ) + 2 k 1 d 2 k + 2 k 2 d 2 k + · · · + d 2 k = 4 k T (1) + d 2 k (2 k 1 + 2 k 2 + · · · + 1) = 4 k c + d 2 k (2 k − 1) = (2 k ) 2 c + d 2 k (2 k − 1) = cn 2 + dn 2 − dn = O ( n 2 ) (b) n ( 3 2 ) log 2 n =...
View
Full
Document
 Spring '08
 Erickson
 Real Numbers, Big O notation, d2k

Click to edit the document details