+1 vote
in Data Structures & Algorithms I by (110k points)
What data structure would you mostly likely see in non recursive implementation of a recursive algorithm?

(a) Linked List

(b) Stack

(c) Queue

(d) Tree

My doubt stems from Stack Operations topic in chapter Abstract Data Types of Data Structures & Algorithms I

I have been asked this question in an interview.

1 Answer

+1 vote
by (412k points)
selected by
 
Best answer
The correct answer is (b) Stack

Explanation: In recursive algorithms, the order in which the recursive process comes back is the reverse of the order in which it goes forward during execution. The compiler uses the stack data structure to implement recursion. In the forwarding phase, the values of local variables, parameters and the return address are pushed into the stack at each recursion level. In the backing-out phase, the stacked address is popped and used to execute the rest of the code.

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.

Categories

...