CodeRevisited Keep Learning.. Cheers!

Reverse a singly linked list

Reverse a singly linked list is one of the most commonly asked data structures interview questions


Given a singly linked list, write a function to reverse it.


If the linked list is 1->2->3->4->5, then the function should change it to 5->4->3->2->1

Iterative Solution

Recursive Solution

Click here for complete code