0

Space complexity to print reverse of linked list

Hi Please refer below code: It just prints linked list in proper order, in reverse order using stack and in reverse order using recursion. I am aware that all three of them has time complexity as O(n). Also stack usage makes space complexity as O(n)... However, does last option i.e. reverse using recursion not have space complexity as O(1)? https://code.sololearn.com/c83psZPyIS6z/?ref=app

31st Aug 2021, 12:28 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
1 Answer