Reverse a Linked List using Recursion

Write a program to reverse a linked list using recursion. Given a singly linked list, we have to write a code to reverse a linked list using recursion. This question is mostly asked in interviews.

In my previous post, I have explained how to reverse a linked list using an iterative approach. In this post, We will learn how to reverse a linked list using recursion.  The time complexity for both iterative and recursive approach is O(n). 

What is a Linked List?

Linked list is a linear collection of data elements, called nodes. Each node is connected to a next node by links ( using a pointer). So linked list is a group of nodes which together represent a sequence. Each node consists of two parts a data and a pointer to next node.

Subscribe Our Tutorials

Get Latest Updates on Facebook

I assume you have basic understand of recursion. If you are not familiar with recursion then check my previous post on recursion concept and difference between recursion and iteration.

C Program to Reverse a Linked List using Recursion

We have discussed what is linked list. Let’s write a c code to reverse a linked list using recursion.

Some more questions on linked list –

Insert a node at the head of a linked list

Count number of nodes in a linked list

About WebRewrite

I am technology lover who loves to keep updated with latest technology. My interest field is Web Development.
Tagged , , . Bookmark the permalink.