chap4-solutions - Selected Solutions for Chapter 4:...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Selected Solutions for Chapter 4: Divide-and-Conquer Solution to Exercise 4.2-4 If you can multiply 3 ± 3 matrices using k multiplications, then you can multiply n ± n matrices by recursively multiplying n=3 ± n=3 matrices, in time T .n/ D kT.n=3/ C ‚.n 2 / . Using the master method to solve this recurrence, consider the ratio of n log 3 k and n 2 : ± If log 3 k D 2 , case 2 applies and T.n/ D ‚.n 2 lg n/ . In this case, k D 9 and T .n/ D o.n lg 7 / . ± If log 3 k < 2 , case 3 applies and T .n/ D ‚.n 2 / . In this case, k < 9 and T .n/ D o.n lg 7 / . ± If log 3 k > 2 , case 1 applies and T .n/ D ‚.n log 3 k / . In this case, k > 9 . T .n/ D o.n lg 7 / when log 3 k < lg 7 , i.e., when k < 3 lg 7 ² 21:85 . The largest such integer k is 21 . Thus, k D 21 and the running time is ‚.n log 3 k / D ‚.n log 3 21 / D O.n 2:80 / (since log 3 21 ² 2:77 ). Solution to Exercise 4.4-6 The shortest path from the root to a leaf in the recursion tree is n ! .1=3/n ! .1=3/ 2 n ! ³³³ ! 1 . Since .1=3/ k n D 1 when k D log 3 n , the height of the part
Background image of page 1

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

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

Page1 / 2

chap4-solutions - Selected Solutions for Chapter 4:...

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