I have a class that stores arbitrarily large integers in the model of a little-endian character array. I need to overload the multiplication operator, and I cannot think of an algorithm that works. Every solution I come up with is hindered by needing to store some values within a int
,double
, or even long long
. all of which are invalid considering these arrays may theoretical contain an infinite number of digits.
Can anybody help me think of an algorithm for multiplication of large arrays? (i created a function for converting a single digit integer into a character, and vice versa)
array1 = {1,2,3,4,5,6,7,8,9}
array2 = {8,7,6,5,4,3,2}
array3 = product
987654321
x 2345678
=________
when array1
and array2
may be infinitely long.
*The use of stdlib classes is prohibited, so no BigInt or Vector
Aucun commentaire:
Enregistrer un commentaire