You are on page 1of 6

BOOTH’S ALGORITHM

(for multiplication and division)


Booths Algorithm is used for finding the multiplicative
product as well as the quotient and remainder for two binary
numbers, by making use of the twos complement notation. It
makes use of arithmetic right shift operation.

MULTIPLICATION:
We have a multiplicand and a multiplier and we are
supposed to find the product of the two. WE firstly convert the
decimal values into their binary equivalent. If a negative
number is involved, we use its signed 2’s complemented value.
Also, we define an “n” as the maximum number of bits of the
multiplier and multiplicand and the product would also use
these many amount of bits.

In one of the registers, we store the binary value of the


multiplier and we also use an accumulator (of size n bits)
whose value is zero at the start of the multiplication operation.
We also use an additional bit “q0” whose value is again 0 at
the start of the operation. “q1” is the last bit of the multiplier.
Based on the value of q1q0, we perform the following
operations.
If q1q0 is “00” or “11”, we just perform arithmetic right shift
of AQq0, else if q1q0 is 01, then we add M to A and then
perform the right shift operation and if q1q0 is 10, then we
subtract M from A and perform the right shift operation on
AQqo.

The following is the flow cart for the above:

Here,
A: Accumulator contents
M: Multiplicand
Q: Multiplier
n: Number of bits
q1: Least bit of Q
q0: Bit whose initial value is 0

Time complexity:
The time complexity of multiplication using Booth’s
Algorithm is O(n^2), where n is the number of bits used.
This is because after we perform a single operation, we reduce
n by 1 and keep doing that unless n becomes 0. So, the code
runs n times. Also, each time the code runs, we perform a
right shift or a two’s complement which also works on n bits
as in a right shift we shift all the n bits. So, the total time
complexity is O(n^2).
DIVISION:
We divide the dividend by the divisor and get the
quotient and remainder. We again first convert the decimal
values to their binary notation.
One of the registers(M) stores the divisor and another
one(Q) holds the dividend. An accumulator with initial value
as 0 is also used.

Initially we perform the left shift operation on AQ and


then subtract M from A and store the result in A. After this
we check the most significant bit of A. If it is 0, then the least
significant bit of Q becomes 1, otherwise it becomes 0 and A is
restored. Then we do n- - and repeat the procedure unless n
becomes 0. Finally, the quotient is stored in the register Q and
remainder in the accumulator A.
The above is the non-restoring algorithm for division.
Here:
A: Accumulator with initial content as 0
M: Divisor
Q: Dividend
n: Number of bits used to express dividend/divisor
Time Complexity:
The time complexity of division is also O(n^2). Using
the same logic as multiplication, we run the code until n
becomes 0, so it runs n times. And every time it runs, we do a
left shift operation, which again shifts and works on n bits,
so in totality the complexity is what is mentioned above.

SARTHAK NEGI 2017097


NIPUN JAIN 2018058

You might also like