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
/*! This file is auto-generated */ .wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;text-decoration:none;padding:calc(.667em + 2px) calc(1.333em + 2px);font-size:1.125em}.wp-block-file__button{background:#32373c;color:#fff;text-decoration:none}
Learning Materials
Features
Discover
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 free
Section 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鈥檚 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?
Show that for any positive integers n and any base b , there must some power of b lying in the range .
Consider the task of searching a sorted array for a given element a task we usually perform by binary search in time . Show that any algorithm that accesses the array only via comparisons (that is, by asking questions of the form 鈥渋s 0?鈥), must take steps.
Practice 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).
Question: You are given an infinite array in which the first n cells contain integers in sorted order and the rest of the cells are filled with . You are not given the value of n. Describe an algorithm that takes an integer x as input and finds a position in the array containing x, if such a position exists, in O(log n) time. (If you are disturbed by the fact that the array A has infinite length, assume instead that it is of length n, but that you don鈥檛 know this length, and that the implementation of the array data type in your programming language returns the error message whenever elements are accessed.)
What do you think about this solution?
We value your feedback to improve our textbook solutions.