Content deleted Content added
→Fast multiplication algorithms for large inputs: html math formatting doesn't work inside the unsolved template |
m normalized spacing in comments in pseudocode |
||
Line 57:
<source lang="pascal">
multiply(a[1..p], b[1..q], base) // Operands containing rightmost digits at index 1
product = [1..p+q] // Allocate space for result
for b_i = 1 to q // for all digits in b
carry = 0
for a_i = 1 to p // for all digits in a
product[a_i + b_i - 1] += carry + a[a_i] * b[b_i]
carry = product[a_i + b_i - 1] / base
|