Warning: foreach() argument must be of type array|object, bool given in /var/www/html/web/app/themes/studypress-core-theme/template-parts/header/mobile-offcanvas.php on line 20

Question: Use the divide-and-conquer integer multiplication algorithm to multiply the two binary integers 10011011and10111010 and .

Short Answer

Expert verified

Multiplication of 10011011and10111010is: 111000010011110

Step by step solution

01

Introduction

This keep dividing and conquering is different technique tackles an issue by:

1. This keep dividing and conquering is different technique tackles an issue by:

2. Solving these sub-problems in a recursive manner

3. Combining their responses in an appropriate manner.

The main work being composed of three parts: splitting issues into sub-problems, solving sub-problems outright at the very end of the recursion, and gluing together partial answers. The algorithm's basic recursive structure holds them all together and coordinates them.

02

Division of given binary numbers

Divide and conquer multiplication:

Apply and consider X=10011011Y=10111010

P1=multiply(X1,Y1)P2=multiply(Xr,Yr)P3=multiply(X1+Xr,Y1+Yr)X*Y=P1*(2n)+(P3-P2-P1)*(24)+P2

Here, given binary number divided into two ( N / 2 )

X1=1001,Y1=1011,Xr=1011,Yr=1010X1+Xr=1001+1011=10100Y1+Yr=1011+1010=10101X1*Y1=1100011callitisP1

03

Multiplication using Divide-and-Conquer

Find Xr * Yr recursively we get,

Xr * Yr = 1011 * 1010 = 1101110 calling it as P2

Find X1+XrxY1+Yrrecursively we are get,

X1+XrxY1+Yr=110100100

Counting of P3 - P2 - P1

P3 - P2 - P1 = 110100100 - 1101110 - 1100011

=11010011

Finally here we can get last answer:

P1*2n+P3-P2-P1*24+P2=1100011*100000000+11010011*00010000+1101110=110001100000000+110100110000+1101110=011100001001111010011011*10111010=111000010011110

This is the required answer.

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with Vaia!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

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โ€™s start with the familiar T(n)=2T(n/2)+o(n). Think of o(n) as being role="math" localid="1658920245976" <cnfor some constant , so: T(n)<2T(n/2)+cn. By repeatedly applying this rule, we can bound T(n) in terms of T(n/2), then T(n/4), then T(n/8), and so on, at each step getting closer to the value of T(.) we do know, namely .

T(1)=0(1).

T(n)โ‰ค2T(n/2)+cnโ‰ค2[2Tn/4+cn/2]+cn=4T(n/4)+2cnโ‰ค4[2Tn/8+cn/4]+2cn=8T(n/8)+3cnโ‰ค8[2Tn/16+cn/8]+3cn=16T(n/16)+4cn

.

.

.

A pattern is emerging... the general term is

T(n)โ‰ค2kT(n/2k)+kcn

Plugging in k=log2n, we get T(n)โ‰คnT(1)+cnlog2n=0(nlogn).

(a)Do the same thing for the recurrence T(n)=3T(n/2)+0(n). What is the general kth term in this case? And what value of should be plugged in to get the answer?(b) Now try the recurrence T(n)=T(n-1)+0(1), 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 x2+1using 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 1+x+2x2and 2 + 3x.

The Hadamard matricesH0,H1,H2,โ€ฆ are defined as follows:

  • โ€ข H0 is the 1ร—1matrix[1]
  • For k>0,Hkisthe2kร—2k matrix

localid="1658916810283" Hk=[Hk-1|Hk-1Hk-1|-Hk-1]

Show that if ฯ… is a column vector of lengthlocalid="1658916598888" n=2k, then the matrix-vector product localid="1658916618774" Hkvcan be calculated using localid="1658916637767" O(nlogn) 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 n2, we now get 5 subproblems of size n2 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) .

  1. Given two n x n matrices A and B, show that the matrix AB + BA can be computed in time 3S(n) + O(n2 ) .
  2. Given two n x n matrices X and Y, define the 2n x 2n matrices A and B,L as follows:
    A=X000andB=0Y00
    What is AB + BA, in terms of X and Y?
  3. Using (i) and (ii), argue that the product XY can be computed in time 3S(2n) + O(n2 ). Conclude that matrix multiplication takes time O(nc ).

You are given an array of nelements, 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 O(nlogn) .

See all solutions

Recommended explanations on Computer Science Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.

Sign-up for free