It will depend on whether you are talking about the stack or complexity with a bunch.
For the heap, this is O(1) or O(0) , since you are not using heap memory. (except for main utility utilities / programs)
For the stack, this is O(n) . This is because recursion raises N levels in depth.
The deepest point:
foo(n) foo(n - 1) foo(n - 2) ... foo(0)
source share