Chapter 2: Q1E (page 83)
Question: Use the divide-and-conquer integer multiplication algorithm to multiply the two binary integers and .
Short Answer
Multiplication of is: 111000010011110
Chapter 2: Q1E (page 83)
Question: Use the divide-and-conquer integer multiplication algorithm to multiply the two binary integers and .
Multiplication of is: 111000010011110
All the tools & learning materials you need for study success - in one app.
Get started for freeSection 2.2 describes a method for solving recurrence relations which is based on analyzing the recursion tree and deriving a formula for the work done at each level. Another (closely related) method is to expand out the recurrence a few times, until a pattern emerges. For instance, letโs start with the familiar . Think of as being role="math" localid="1658920245976" for some constant , so: . By repeatedly applying this rule, we can bound in terms of , then , then , and so on, at each step getting closer to the value of we do know, namely .
.
.
.
A pattern is emerging... the general term is
Plugging in , we get .
(a)Do the same thing for the recurrence . What is the general th term in this case? And what value of should be plugged in to get the answer?(b) Now try the recurrence , a case which is not covered by the master theorem. Can you solve this too?
Practice with polynomial multiplication by FFT.
(a) Suppose that you want to multiply the two polynomials x + 1 and using the FFT. Choose an appropriate power of two, find the FFT of the two sequences, multiply the results component wise, and compute the inverse FFT to get the final result.
(b) Repeat for the pair of polynomials and 2 + 3x.
The Hadamard matrices are defined as follows:
localid="1658916810283"
Show that if is a column vector of lengthlocalid="1658916598888" , then the matrix-vector product localid="1658916618774" can be calculated using localid="1658916637767" operations. Assume that all the numbers involved are small enough that basic arithmetic operations like addition and multiplication take unit time.
Thesquare of a matrix A is its product with itself, AA.
(a) Show that five multiplications are sufficient to compute the square of a 2 x 2 matrix.
(b) What is wrong with the following algorithm for computing the square of an n x n matrix?
โUse a divide-and-conquer approach as in Strassenโs algorithm, except that instead of getting 7 subproblems of size , we now get 5 subproblems of size thanks to part (a). Using the same analysis as in Strassenโs algorithm, we can conclude that the algorithm runs in time O (nc) .โ
(c) In fact, squaring matrices is no easier than matrix multiplication. In this part, you will show that if n x n matrices can be squared in time S(n) = O(nc), then any two n x n matrices can be multiplied in time O(nc) .
You are given an array of elements, and you notice that some of the elements are duplicates; that is, they appear more than once in the array. Show how to remove all duplicates from the array in time .
What do you think about this solution?
We value your feedback to improve our textbook solutions.