You are viewing a single comment's thread. Return to all comments →
My Java solution:
public static void reversePrint(SinglyLinkedListNode llist) { SinglyLinkedListNode reverseList = null; SinglyLinkedListNode current = llist; while (current != null) { SinglyLinkedListNode temp = new SinglyLinkedListNode(current.data); temp.next = reverseList; reverseList = temp; current = current.next; } while (reverseList != null) { System.out.println(reverseList.data); reverseList = reverseList.next; } }
Seems like cookies are disabled on this browser, please enable them to open this website
Print in Reverse
You are viewing a single comment's thread. Return to all comments →
My Java solution: