Question 11
Back to Exercise
A recursive factorial(n) makes n nested calls. How much extra memory does the call stack use?
- A O(1)
- B O(log n)
- C O(n²)
- D O(n) Correct
Correct Answer: Option D
All n frames are alive at the deepest point. A loop would need O(1).
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!