Data Str & Algorithm HW Solutions 92

Data Str & Algorithm HW Solutions 92 - 92 Chap 14...

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

View Full Document Right Arrow Icon
92 Chap. 14 Analysis Techniques B elements are repeatedly reinserted one fewer times, the next 2B elements 2 fewer times, etc. Thus, once we insert 2 i B elements, we have done a total number of insertions costing 2 i B +2 i 1 B +2 i 2 2 B + ··· +2 i 1 B . This works out to requiring about two inserts per element. 14.14 (a) By adding the components in each quadrant of the matrix, you will f nd that s 1 + s 2 s 4 + s 6 = A 11 B 11 + A 12 B 21 s 4 + s 5 = A 11 B 12 + A 12 B 22 s 6 + s 7 = A 21 B 11 + A 22 B 21 s 2 s 3 + s 5 s 7 = A 21 B 12 + A 22 B 22 (b) Strassen’s algorithm requires 7 matrix multiplies and 18 matrix addi- tions, while the regular algorithm requires 8 matrix multiplies and 4 matrix additions. The recurrence relation for Strassen’s algorithm is T ( n )=7 T ( n/ 2) + 18( n/ 2) 2 while the recurrence relation for the regular algorithm is T ( n )=8 T ( n/ 2)+4( n/ 2) 2 (c) Plugging the constants from the recurrence relation into Theorem 14.1,
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.
Ask a homework question - tutors are online