0

由于我们已经注册了名为 result ,我相信我们不必有堆栈来将结果保存在内存中,我们只需要 1 个内存空间。我在大 O(1) 中假设正确的 s(n) 也是如此。

4

1 回答 1

0

The space complexity is given by the number of bits of the result. Using Stirling's approximation, log n! is O(n log n).

于 2013-06-17T13:32:07.757 回答