Home » Data Structure & Algorithms » Reverse a LinkedList with out recursion iteratively

Reverse a LinkedList with out recursion iteratively

 

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 *

12 − 2 =