Author: techfox9
Reversing a singly-linked list in Java ..
Sunday, December 27th, 2009 @ 11:31 am
From http://www.informatics.susx.ac.uk/courses/dats/notes/html/node46.html
public void reverse(ListNode head) {
ListNode current = head;
head = null;
ListNode save = null;
while (current != null) {
save = current;
current = current.next;
save.next = head;
head = save;
}
}
