forked from jainaman224/Algo_Ds_Notes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolvoing the issue jainaman224#3109
- Loading branch information
1 parent
6033512
commit c9fd832
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
|
||
} | ||
} |