Section 8.2 227 also involves the multiplication of a number with perhaps n + 2 digits by 2, requires at most 3n + [3(n + 2) -2] = 6n + 4 operations. The next step requires at most 6n + 7 operations, and so on. Assuming k steps, the number of multiplications and divisions by 2 is at most (6n -2) + (6n + 1) + (6n + 4) + (6n + 7) + ... + (6n + 3k -5) = k(6n) + [-2 + 1 + 4 + ... + (3k -5)] = k(6n) + ~[2( -2) + (k -1)3] = 6kn + ~(3k -7) = ~k2 -~k + 6kn ~ ~k2 + 6kn, using the fact that the sum of the first k terms of the arithmetic sequence a, a + d, a + 2d, ... is ~[2a + (k -l)d]-see (7) on p. 234. By part (a), k < 1 + nlog21O, so the number of multiplications and divisions by 2 is at most (c) We must add at most k integers, each with at most n + k digits. Using Problem 16, we see that this requires at most k[2(n + k) + k] ~ (1 + nlog21O)((2n + 3 + 3nlog21O) = 0(n2) basic operations. (d) We use the result of Exercise 9. Since the number of operations required by each of the two stages of the algorithm is 0 ( n 2), the total number of operations is 0 ( n 2), as desired. 27. (a) For real numbers a and b, we have (a+b)2 = a2 +2ab+b2 ~ lal2 +2lallbl + Ibl2 = (Ial + Ib1)2.
This is the end of the preview.
access the rest of the document.