Which data structure is used for implementing recursion
Options
- A. Array
- B. List
- C. Queue
- D. Stack
D. Stack
Recursion works using the call stack.
When a function calls itself, the system:
Pushes the function’s local variables and state onto a stack.
After the function finishes, it pops the data from the stack.
This follows LIFO (Last In, First Out) principle.
(a) Queue → Works on FIFO (First In, First Out).
(b) List → General collection, not specifically used for recursion.
(c) Array → Just a data storage structure.
Attempt Quiz Now:
BPSC Tre 4.0 DSA Practice Set