• retagged by
3,530 views
1 1 vote
Does Heap Allocation support both recursion and dynamic memory allocation? Because,a stack can be implemented using dynamic memory allocation.Please correct me.

Test Series answer shows only dynamic memory allocation

1 Answer

Best answer
3 3 votes
Heap support dynamic allocation but not recursion

because recursion need stack structure

now one thing more

If you are willing to convert your recursion to iteration, then it is possible to use only heap space, but that isn't really recursion. You would do so by implementing a stack in the heap.
• selected by
Position:
Show:

Related questions

2 2 votes
4 4 answers
2.7k
2.7k views
ManojK asked Jan 9, 2017
2,666 views
Consider the following two statements$:$ $S_{1}:$ Activation records can have a permanent lifetime in case of static allocation.$S_{2}:$ Activation records can have neste...
1 1 vote
1 1 answer
666
666 views
thor asked Nov 17, 2016
666 views
I searched a lot and tried understanding access link in activation record, but didn't get very far. Please explain?Access link points to activation record associated with...
0 0 votes
1 answers 1 answer
721
721 views
0 0 votes
3 3 answers
2.5k
2.5k views
rahul sharma 5 asked May 11, 2018
2,455 views
As actual parameters are stored in the Actual parameter field in case of Activation record then where does formal parameters will be stored?f(a,b){a(e,f)}Here e,f are act...