Chapter 2: Q26E (page 88)
Professor F. Lake tells his class that it is asymptotically faster to square an -bit integer than to multiply two n-bit integers. Should they believe him?
Short Answer
No, the statement of Professor F. Lake is wrong.
Chapter 2: Q26E (page 88)
Professor F. Lake tells his class that it is asymptotically faster to square an -bit integer than to multiply two n-bit integers. Should they believe him?
No, the statement of Professor F. Lake is wrong.
All the tools & learning materials you need for study success - in one app.
Get started for freePractice with the fast Fourier transform.
(a) What is the FFT of (1,0,0,0)? What is the appropriate value of in this case? And of which sequence is (1,0,0,0)the FFT?
(b)Repeat for (1,0,1,-1).
In this problem we will develop a divide-and-conquer algorithm for the following geometric task.
CLOSEST PAIRInput: A set of points in the plane,
Output: The closest pair of points: that is, the pair for which the distance between and , that is,
,
is minimized.
For simplicity, assume that n is a power of two, and that all the x-coordinates role="math" localid="1659237354869" are distinct, as are the y-coordinates.
Here’s a high-level overview of the algorithm:
.Find a value for which exactly half the points have , and half have . On this basis, split the points into two groups, L and R.
• Recursively find the closest pair in L and in R. Say these pairs are and with distances and respectively. Let d be the smaller of these two distances.
• It remains to be seen whether there is a point in Land a point in R that are less than distance dapart from each other. To this end, discard all points with or and sort the remaining points by y-coordinate.
• Now, go through this sorted list, and for each point, compute its distance to the seven subsequent points in the list. Let be the closest pair found in this way.
• The answer is one of the three pairs role="math" localid="1659237951608" , whichever is closest.
(a) In order to prove the correctness of this algorithm, start by showing the following property: any square of size in the plane contains at most four points of L.
(b) Now show that the algorithm is correct. The only case which needs careful consideration is when the closest pair is split between L and R.
(c) Write down the pseudocode for the algorithm, and show that its running time is given by the recurrence:
Show that the solution to this recurrence is .
(d) Can you bring the running time down to ?
Suppose you are choosing between the following three algorithms: • Algorithm A solves problems by dividing them into five sub-problems of half the size, recursively solving each sub-problem, and then combining the solutions in linear time. •
Algorithm B solves problems of size n by recursively solving two sub-problems of size and then combining the solutions in constant time. • Algorithm C solves problems of size n by dividing them into nine sub-problems of size , recursively solving each sub-problem, and then combining the solutions in time.
What are the running times of each of these algorithms (in big- O notation), and which would you choose?
In justifying our matrix multiplication algorithm (Section 2.5), we claimed the following block wise property: if X and Y are n matrices, and
,
where A,B,C,D,E,F,G, and H are sub-matrices, then the product XY can be expressed in terms of these blocks:
Prove this property.
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.
What do you think about this solution?
We value your feedback to improve our textbook solutions.