Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String [] args)
- {
- //Example list
- LL LinkedList = new LL();
- LinkedList.addFront(15);
- LinkedList.addFront(20);
- LinkedList.addFront(100);
- //Print it out
- reverseLinkedList(LinkedList.head);
- }
- public static void reverseLinkedList(Node test)
- {
- if( test.next == null)
- {
- //At end of LL, start printing
- System.out.println(test.data);
- }
- else{
- reverseLinkedList(test.next);
- System.out.println(test.data);
- }
- }
Add Comment
Please, Sign In to add comment