Fast Multiplication
Explore fast multiplication algorithms by understanding divide-and-conquer strategies and Karatsuba’s algorithm. Learn how recursive calls reduce complexity for multiplying large numbers in Java, and delve into the progression from basic multiplication to advanced methods that improve time efficiency.
We'll cover the following...
Divide and conquer algorithm
Two ancient algorithms for multiplying two -digit numbers in time are: the grade-school lattice algorithm and the Egyptian peasant algorithm. Maybe we can get a more efficient algorithm by splitting the digit arrays in half and exploiting the following identity:
This recurrence immediately suggests the following divide and conquer algorithm to multiply two -digit numbers, and . Each of the four sub-products, and , is computed recursively, but the multiplications in the last line are not recursive because we can multiply by a power of ten by shifting the digits to the left and filling in the correct number of zeros, all in time.
Algorithm
...