Complexity of recursive factorial program
If you take multiplication as O(1), then yes, O(N) is correct. However, note that multiplying two numbers of arbitrary length x is not O(1) on finite hardware — as x tends to infinity, the time needed for multiplication grows (e.g. if you use Karatsuba multiplication, it’s O(x ** 1.585)). You can theoretically do better for … Read more