3-digit integers with 6 single-digit multiplications
In class, we discussed a divide-and-conquer algorithm (attributed to Karatsuba)
to multiply two long integers by dividing the numbers into two halves and using
only 3 half-size multiplications, with time complexity πΆ(π
πππππ
) = πΆ(π
π.πππ). In this
exercise, we explore dividing the integers into three.
(a) Consider two 3-digit decimal integers π¨ = ππππππ and π© = ππππππ. The
standard elementary-school method of multiplication requires π Γ π = π single
digit multiply.
ππ ππ ππ
Γ ππ ππ ππ
________________________________________________________________________
ππππ ππππ ππππ
ππππ ππππ ππππ
ππππ ππππ ππππ
________________________________________________________________________
ππππ (ππππ + ππππ) (ππππ + ππππ + ππππ) (ππππ + ππππ ) ππππ
Let us call the 5 sum terms as (π»π, π»π, π»π, π»π, π»π), from left-to-right.
Show how it can be done with only six single-digit multiplications, and some
additions/subtractions. Show clearly your 6 multiplication steps, and then show
how the sum terms are computed by some additions/subtractions.
(b) Illustrate your algorithm for the example (πππ Γ πππ).
(c) Analyze the time complexity of a divide-and-conquer algorithm based on this
technique. (The time complexity is worse than Karatsuba algorithm.)