Guest User

Untitled

a guest
Jan 23rd, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. public static void main(String [] args)
  2. {
  3. //Example list
  4. LL LinkedList = new LL();
  5. LinkedList.addFront(15);
  6. LinkedList.addFront(20);
  7. LinkedList.addFront(100);
  8.  
  9. //Print it out
  10. reverseLinkedList(LinkedList.head);
  11. }
  12.  
  13. public static void reverseLinkedList(Node test)
  14. {
  15. if( test.next == null)
  16. {
  17. //At end of LL, start printing
  18. System.out.println(test.data);
  19. }
  20. else{
  21. reverseLinkedList(test.next);
  22. System.out.println(test.data);
  23. }
  24. }
Add Comment
Please, Sign In to add comment