Intermediate
Data Structures & Algorithms
Q79 / 100
When converting a recursive algorithm into an iterative one using an explicit stack, what is being manually managed?
Correct! Well done.
Incorrect.
The correct answer is B) The state that the call stack would otherwise track automatically — such as which subproblem to process next and what to do after it returns
B
Correct Answer
The state that the call stack would otherwise track automatically — such as which subproblem to process next and what to do after it returns
Explanation
Recursive calls implicitly use the call stack to remember pending work and return points. Replacing recursion with an explicit stack means the programmer pushes and pops that same state manually, which can avoid stack-overflow risk for deep recursion and sometimes improves performance.
Progress
79/100