Home » Data Structure & Algorithms » Print Reverse of LinkedList

Print Reverse of LinkedList

 

Question :
WAP to find the length of Linked List in O(n) time complexity.

Solution :
The problem is solved in recursive way.

Algorithm : 
Step 1 : If head is null, then return.
Step 2 : Recursively traverse each node till we reach end .Keep on printing on reaching end.

Program :

Output :

 
 


Leave a comment

Your email address will not be published. Required fields are marked *

10 − 9 =