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

The grade-school algorithm for multiplying two n-bit binary numbers x and y consist of addingtogethern copies of r, each appropriately left-shifted. Each copy, when shifted, is at most 2n bits long.
In this problem, we will examine a scheme for adding n binary numbers, each m bits long, using a circuit or a parallel architecture. The main parameter of interest in this question is therefore the depth of the circuit or the longest path from the input to the output of the circuit. This determines the total time taken for computing the function.
To add two m-bit binary numbers naively, we must wait for the carry bit from position i-1before we can figure out the ith bit of the answer. This leads to a circuit of depthΟ(m). However, carry-lookahead circuits (seewikipedia.comif you want to know more about this) can add inΟ(logn)depth.

  1. Assuming you have carry-lookahead circuits for addition, show how to add n numbers eachm bits long using a circuit of depth Ο(lognlogm).
  2. When adding three m-bit binary numbers x+y+z, there is a trick we can use to parallelize the process. Instead of carrying out the addition completely, we can re-express the result as the sum of just two binary numbersr+s, such that the ith bits of r and s can be computedindependently of the other bits. Show how this can be done. (Hint: One of the numbers represents carry bits.)
  3. Show how to use the trick from the previous part to design a circuit of depthΟ(logn)for multiplying two n-bit numbers.

Short Answer

Expert verified
  1. Here, totally this addition operation containsΟlognlogm depth.
  2. The value of"r" and "s"has been taken and then it can be mentionedasx+y+z=r+s.
  3. The multiplication process can be represented as n×23k=1where k=lognlog3-log2=Οlogn.

Step by step solution

01

Step 1: Introduction to the Concept

Parallel architectures are a type of distributed computing in which multiple processes work together to solve a single problem.

02

Step 2: Solution Explanation

a)

Assume that "n" equals "2" and "k" equals a fixed value for minimalism.

  • Here are the instructions for adding "n" numbers:
    1. At first, the "2k" numbers must be divided into “2k-1”different pairs."
    2. Next, add each pair of values using look-ahead circuits.
    3. Repeat the process for each of the results returned by the previous operation.
    4. A complete binary tree with "logn" levels have been created utilizing the results of the foregoing process.
  • Each level employs " logm" extra levels for additional operations.
  • Take note that if "n" is not a power of "2", the tree will not be completed.

As a result, this additional operation comprises “Οlognlogm”in total in-depth.

03

Step 3: Solution Explanation

b)

Assume that the "ith" bit of "r" is the result of adding the "ith" bits of all three values.

  • Also, consider "s" as the carry of adding the "ith" bit of three integers (i.e., the carry is "1" when two or three of the "ith" values are "1").

As a result, assuming the previous steps have taken the values of "r" and "s" it may be written as "x+y+z=r+s."

04

Step 4: Solution Explanation

c)

To multiply, "n" copies of "x" that are slightly moved must be added together.

  • The copies of numbers must be split into triplets and the addition operation conducted in the part (b) must be completed.
  • Repeat these steps for each of the "k" levels until only three numbers remain.

As a result, “n=23k=1can be used to describe the multiplication process, where

k=lognlog3-log2=Οlogn”.

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

Unlike a decreasing geometric series, the sum of the1,12,13,14,15,..... diverges; that is,i=1n1i=

It turns out that, for large n , the sum of the first n terms of this series can be well approximated as

i=1n1iInn+y

where is natural logarithm (log base e=2.718...) and y is a particular constant 0.57721...... Show that

i=1n1i=θ(logn)

(Hint: To show an upper bound, decrease each denominator to the next power of two. For a lower bound, increase each denominator to the next power of 2 .)

Determine necessary and sufficient conditions on xandc so that the following holds: for anya,b, if axbxmodc, thenabmodc .

What is the least significant decimal digit of (1717)17? (Hint: For distinct primesp,q, and any a is not equal to role="math" localid="1658726105638" a0(modpq), we proved the formula role="math" localid="1658726171933" a(p-1)1(modpq)in Section 1.4.2.)

Let[m]denote the set{0,1,,m1}. For each of the following families of hash functions, say whether or not it is universal, and determine how many random bits are needed to choose a function from the family.

(a) H={ha1,a2:a1,a2[m]}, wheremis a fixed prime and

ha1·ha1,a2(x1,x2)=a1x1+a2x2modm

Notice that each of these functions has signatureha1,a2:[m]2[m]that is, it maps a pair of integers in[m]to a single integer in[m].

(b) His as before, except that nowm=2kis some fixed power of.2

(c) His the set of all functionsf:[m][m1].

A positive integer N is a power if it is of the formqk , where q,role="math" localid="1658399000008" k are positive integers and k>1.

(a) Give an efficient algorithm that takes as input a number and determines whether it is a square, that is, whether it can be written asq2 for some positive integer q. What is the running time of your algorithm?

(b) Show that if N=qk (with role="math" localid="1658399171717" N,q , andk all positive integers), then either role="math" localid="1658399158890" klogNorN=1.

(c) Give an efficient algorithm for determining whether a positive integerN is a power. Analyze its running time.

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