LearnFrenzy
Sign in Take a free test

Recursion · Recursion MCQ · Question 11

Space used by linear recursion Answer, explanation & discussion

  • MCQ
  • Hard
  • 0 comments
  • Answer explained
  • Moderated community
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!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links