Professional Documents
Culture Documents
3 D and C - Karatsuba
3 D and C - Karatsuba
Dr. D. P. Acharjya
Professor, SCOPE
Office: SJT Annex 201E
Email: debiprasannaacharjya@vit.ac.in
Number of multiplications = 16 = 42
If there are n bits, The computing time = (n2)
9 January 2024 Dr. D. P. Acharjya 3
Karatsuba’s Fast Multiplication
Consider two integers a and b
Divide both the integers into two equal parts such as
a = a1a2 and b = b1b2
Compute A = a1b1
Compute B = a2b2
Compute C = (a1 + a2) (b1 + b2)
Compute D = C – A – B
The product ab = bn A + bn/2 D + B
Where b is the base of the integer and n is the length
of the integers.
9 January 2024 Dr. D. P. Acharjya 4
Computing Time
Let the length of two integers a and b be n.
Length of a1, a2, b1, and b2 be (n/2)
A = a1b1 Computing Time = T(n/2)
B = a2b2 Computing Time = T(n/2)
C = (a1 + a2) (b1 + b2) Computing Time = T(n/2)
D = C – A – B Computing Time = constant
ab =bn A + bn/2 D + B Computing Time = Constant
The recurrence relation is
T(n) = 3T(n/2) + k
9 January 2024 Dr. D. P. Acharjya 5
Continued …