1. If n = 1 or n = 2 solve the problem directly; Otherwise:
2. Construct four half-size polynomials a, b, c and d, of degree n/2 - 1, out of X and Y. Divide X up into parts, a and b, and divide Y up into parts c and d -- so a and c will have the low order coefficients (indices 0 through n/2 -1) of X and Y, and b and d will have the high order coefficients (indices n/2 through n -1).
3. Calculate the sums x' = a + b and y' = c + d -- note that x' and y' are also polynomials of degree n/2 - 1.
4. Calculate temp = x' . y' recursively. 5. Calculate ac, and bd recursively.
6. Let temp = temp - ac - bd;
7. Combine ac, bd, and temp, which are all polynomials of degree n - 1, into a new polynomial of degree 2n -1, placing ac in indices 0 through n - 1, bd in indices n through 2n - 1, and adding temp to the values now in indices n/2 through 3n/2 -1. Notice that the highest coefficient will be 0.
من این الگوریتم و پیدا کردم، میخوام با ++c بنویسم. اما هیچی ازش نمی فهمم. یعنی نمی فهمم این چند جمله ای رو چطوری ضرب میکنه!
![Shocked :shock: :shock:](/styles/majidonline/smilies/majidonline_shocked.gif)