By making use of recursion, we can multiply two integers with the given constraints.
To multiply x and y, recursively add x y times.
Time Complexity: O(y) where y is the second argument to function multiply().
Please write comments if you find any of the above code/algorithm incorrect, or find better ways to solve the same problem.
- Russian Peasant (Multiply two numbers using bitwise operators)
- Sieve of Eratosthenes
- Count numbers that don't contain 3
- Average of a stream of numbers
- Program for Fibonacci numbers
- Print all combinations of balanced parentheses
- Write you own Power without using multiplication(*) and division(/) operators
- Print all combinations of points that can compose a given number
- Babylonian method for square root
- Write a program to add two numbers in base 14
- Lucky Numbers
- Write a program to print all permutations of a given string
- Power Set
- Efficient way to multiply with 7
- Write a program to calculate pow(x,n)
Improved By : Mithun Kumar