Divide-and-conquer multiplication of large integers: use FFT for O(n lg n).
Analyze the divide-and-conquer multiplication of large integers: use fft for o(n lg n)..
Examples
Input: "test_input_1"
Output: "output_1"
Input: "test_input_2"
Output: "output_2"
Hints
Recall how the Fast Fourier Transform (FFT) can be used to multiply two polynomials efficiently by converting the problem into point-value representation, performing point-wise multiplication, and then converting back to coefficient form.
Consider how to represent large integers as polynomials where each coefficient corresponds to a digit (or a group of digits) of the number, and how the multiplication of these polynomials relates to the multiplication of the original integers.
Implement the FFT-based multiplication by first padding the polynomials with zeros to make their lengths a power of two, then applying the Cooley-Tukey algorithm to compute the FFT, perform point-wise multiplication, and finally use the inverse FFT to obtain the result polynomial, which can be converted back to the product of the original integers.
Divide-and-conquer multiplication of large integers: use FFT for O(n lg n).
Analyze the divide-and-conquer multiplication of large integers: use fft for o(n lg n)..