The problem is that i need to write a recursive algorithm for reversing a singly linked list L, so that the ordering of the nodes becomes opposite.
it seems a bit abstract, but i don’t need code or anything and since the problem requests an algorithm, i am kind of stuck.
I don’t know were to begin, i mean i have had some simple things to do regarding linked lists, like add to the front and delete but, reversing (and especially recursive) seems like a wall.
The problem is that i need to write a recursive algorithm for reversing a
Share
Since you don’t need to provide specific code, I’d be doing your homework if I even gave you pseudo code, so I’ll just give you some hints 😉
The general approach would be to do
To reverse
1 -> 2 -> 3it would go like