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.)