retagged by
2,081 views
1 votes
1 votes
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
retagged by

1 Answer

Best answer
3 votes
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

Related questions

1 votes
1 votes
1 answer
2
thor asked Nov 17, 2016
385 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...