{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Data Str & Algorithm HW Solutions 91

Data Str & Algorithm HW Solutions 91 - 91 n log n...

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

View Full Document Right Arrow Icon
91 Clearly this is smaller than n log n , so we will guess that T ( n ) = Θ( n log n. To complete the proof we must show that T ( n ) is in Ω( n log n ) , but this turns out to be impossible. On the other hand, the recurrence is clearly n . So, let’s guess that T ( n ) is in O ( n ) for c = 4 , n 0 = 2 . We prove this by induction. Base case : T (2) = 1 + 2 < 4 2 , so the hypothesis is correct. Induction Hypothesis : For any value less than or equal to k , T ( k ) < 4 k . Induction Step : For 2 k , T (2 k ) = T ( k ) + 2 k. By the induction hypothesis, T ( k ) + 2 k < 4 k + 2 k. For the theorem to be correct, T ( k ) + 2 k < 4 k + 2 k < 4 2 k which is true. Thus, by the principle of Mathematical Induction, the theorem is correct. 14.11 Expanding the recurrence, we get T ( n ) = 2 T ( n/ 2) + n
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}