Which of the basic data structures is the most suitable if you only need to implement recursion in a programming language? When you make a recursive call, you need to save the function you are currently in and its parameters values in some data structure, so that when you go out of the recursion you can restore the state. When you go out of the recursive call, you will always need to extract the last element that was put in the data structure.
Answers
Answered by
0
Answer:
The best data structure for such simple recursive functions will be Arrays.
In computer science an array is the simplest data structure. It can hold all primitive types and any major programming language will have arrays.
But arrays have defined size. ie the size can not be increased or decreased once declared. To solve this problems lists were introduced. a list or sequence is an abstract data type that represents a finite number of ordered values they can be dynamically sized. The size increases as you add elements and decreases as you remove elements.
Explanation:
Similar questions