Introduction to Algorithms
Introduction to Algorithms
3rd Edition
ISBN: 9780262033848
Author: Thomas H. Cormen, Ronald L. Rivest, Charles E. Leiserson, Clifford Stein
Publisher: MIT Press
Question
Book Icon
Chapter 30, Problem 1P

a.

Program Plan Intro

To multiply two linear polynomials ax+b and cx+d using only three multiplications.

a.

Expert Solution
Check Mark

Explanation of Solution

Multiply two linear polynomials ax+b and cx+d using only 3 multiplications as follows:

  (a+b)(c+d)=ac+cb+ad+cd

Thus, the product of two polynomials is as follows:

  acx2+((a+b)(c+d)accd)x+cd

b.

Program Plan Intro

To provide two divide-and-conquer algorithms for multiplying two polynomials of degree-bound n in Θ(nlg3) time.

b.

Expert Solution
Check Mark

Explanation of Solution

Method 1(for dividing the input polynomial coefficients into a high half and low half):

Take two polynomials be P1 and P2 such that, P1(x)=j=1n1aj,1xj and P2(x)=j=1n1aj,2xj .

Now, assume that two polynomials are to be multiplied. Then,High half will be Hi(x)=j=n/2n1aj,ixj and Low half will be Li(x)=j=n/2n/21aj,ixj wherei =1,2….and so on.

Since, it is known that Pi(x)=Hi(x)xn/2+Li(x) wherei =1,2…and so on.Therefore, by multiplication of two polynomials following is obtained:

  P1(x)P2(x)=(H1(x)H2(x))xn+(H1(x)+L1(x))(H2(x)+L2(x))

  (H1(x)H2(x)L1(x)L2(x))xn/2+L1(x)L2(x)

Now on using master’s theorem the recurrence for above is calculatedto be as follows:

  T(n)=3T(n/2)+θ(n)

  θ(nlg(n))

Method2(for dividingthe input polynomial coefficients based onif the index is even or odd the procedure):

Assume the odd index beOiand even index be Eisuch that Oi(x)=j=0n/21a2j+1,jxj and Ei(x)=j=0n/21a2j,jxj where i goes from 1,2, 3… and so on.

Then, Pi=xO(x2)+Ei(x2)

Therefore,

  P1(x)P2(x)=x2(O1(x2)O2(x2))+x(O1(x2)+E1(x2))(O2(x2)+E1(x2))(O1(x2)O2(x2)E1(x2)E2(x2))+E1(x2)E2(x2)

Now on using master’s theorem the recurrence for above is calculatedto be as follows:

  T(n)=3T(n/2)+θ(n)

  θ(nlg(n))

c.

Program Plan Intro

To show methodto multiply two n-bit integers in O(nlg3) steps.

c.

Expert Solution
Check Mark

Explanation of Solution

To multiply two n-bit integers in O(nlg3) steps, take two integers P1 and P2 such that

  P1=k=0lg(A1)ak,12k and P2=k=0lg(A2)ak,22k .

The generalization of the polynomial can be given as f1=k=0lg(Ai)ak,ixi .

The two n-bit integers can be taken as P1nP1n1........P1 and P2nP2n1........P2 where 0P1i10 and 0P2i10 . The value P1i and P2i represent the number on every digit i = {1,2,3…n}

  P1n10n1+P1n110n2+.+P1210+P11

  P2n10n1+P2n110n2++P2210+P21

These two algorithms are developed to solve the multiplication problem of polynomialwith run time of O(nlg3) by using divide and conquer. Each operationdeal with either P1or P2, they are of 1bit values.

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
Order the functions in increasing order
Suppose that a Professor were to develop a method of multiplying two 12 x 12 matrices using 150 scalar multiplications and a constant number of scalar additions and subtractions: What is the recurrence equation that describes the resulting divide and conquer algorithm for multiplying two n x n matrices? And what is the asymptotic solution of the equation (use big O notation)?
Suppose that a Professor were to develop a method of multiplying two 12 x 12 matrices using 150 scalar multiplications and a constant number of scalar additions and subtractions: Write down the recurrence equation that describes the resulting divide and conquer algorithm for multiplying two n x n matrices. Write down the asymptotic solution of your equation from above.
Knowledge Booster
Background pattern image
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education