Skip to content

Instantly share code, notes, and snippets.

@evanpurkhiser
Forked from RSquaredSoftware/gist:3688255
Created September 10, 2012 01:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evanpurkhiser/3688271 to your computer and use it in GitHub Desktop.
Save evanpurkhiser/3688271 to your computer and use it in GitHub Desktop.
void LinkedList<T>::reverseList()
{
ListNode<T> *previous;
previous = NULL;
ListNode<T> *temp;
while(head != NULL)
{
temp = head->next;
head->next = previous;
previous = head;
head = temp;
}
head = previous;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment