Introduction To Algorithms, Third Edition (international Edition)
Introduction To Algorithms, Third Edition (international Edition)
3rd Edition
ISBN: 9780262533058
Author: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, Clifford Stein
Publisher: TRILITERAL
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
Q.1. Architecture performance [10 marks] Answer A certain microprocessor requires either 2, 4, or 6 machine cycles to perform various operations. ⚫ (40+g+f)% require 2 machine cycles, ⚫ (30-g) % require 4 machine cycles, and ⚫ (30-f)% require 6 machine cycles. (a) What is the average number of machine cycles per instruction for this microprocessor? Answer (b) What is the clock rate (machine cycles per second) required for this microprocessor to be a "1000 MIPS" processor? Answer (c) Suppose that 35% of the instructions require retrieving an operand from memory which needs an extra 8 machine cycles. What is the average number of machine cycles per instruction, including the instructions that fetch operands from memory?
Q.2. Architecture performance [25 marks] Consider two different implementations, M1 and M2, of the same instruction set. M1 has a clock rate of 2 GHz and M2 has a clock rate of 3.3 GHz. There are two classes of instructions with the following CPIs: Class A CPI for M1 CPI for M2 2.f 1.g B 5 3 C 6 4 Note that the dots in 2 fand 1.g indicate decimal points and not multiplication. a) What are the peak MIPS performances for both machines? b) Which implementation is faster, if half the instructions executed in a certain program are from class A, while the rest are divided equally among classes B and C. c) What speedup factor for the execution of class-A instructions would lead to 20% overall speedup? d) What is the maximum possible speedup that can be achieved by only improving the execution of class-A instructions? Explain why. e) What is the clock rate required for microprocessor M1 to be a "1000 MIPS" (not peak MIPS) processor?
PLEASE SOLVE STEP BY STEP WITHOUT ARTIFICIAL INTELLIGENCE OR CHATGPT I don't understand why you use chatgpt, if I wanted to I would do it myself, I need to learn from you, not from being a d amn robot. SOLVE  STEP BY STEP I WANT THE DIAGRAM PERFECTLY IN SIMULINK
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Operations Research : Applications and Algorithms
Computer Science
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Brooks Cole
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:9780357392676
Author:FREUND, Steven
Publisher:CENGAGE L