Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Reverse linklist using resursion.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
public class ReverseLinkedList {
public static void main(String[] args) {
LinkedList li=new LinkedList();
li.InsertData(5);
li.InsertData(55);
li.InsertData(555);
li.InsertData(5555);
Node head=li.head;
reverse(head);
}
public static void reverse(Node head)
{
if(head==null)
return;

reverse(head.next);
System.out.println(head.val);

}
}