I started a new course in algorithms. The professor is trying to create a multiplication algorithm with other rules.
He divides the digits of the numbers we are trying to multiply into two groups for example. x = 3452
then a = 34
, b = 52
(the same applies for y
).
According to him, the base operation would be:
If you're given two numbers that have the just one digit each. Then you just multiply them in one basic operation and return the result.
How would you compute ac
, ad
, bc
and bd
recursively if those are very simple operations?