Revisions
-
evanpurkhiser revised this gist
Sep 10, 2012 . 1 changed file with 5 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,20 +1,16 @@ 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; -
evanpurkhiser revised this gist
Sep 10, 2012 . 1 changed file with 7 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,26 +1,21 @@ template <typename T> void LinkedList<T>::reverseList() { ListNode<T> *nodePtr; nodePtr = head; ListNode<T> *previous; previous = NULL; ListNode<T> *temp; while(nodePtr != NULL) { temp = nodePtr->next; nodePtr->next = previous; previous = nodePtr; nodePtr = temp; } head = previous; } -
evanpurkhiser revised this gist
Sep 10, 2012 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,7 +12,7 @@ void LinkedList<T>::reverseList() head->next = NULL; while(nodePtr->next != NULL) { temp = nodePtr->next; @@ -23,4 +23,4 @@ void LinkedList<T>::reverseList() } head = nodePtr; } -
evanpurkhiser revised this gist
Sep 10, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,8 +18,8 @@ void LinkedList<T>::reverseList() nodePtr->next = previous; previous = nodePtr; nodePtr = temp; } head = nodePtr; -
evanpurkhiser revised this gist
Sep 10, 2012 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,6 +18,7 @@ void LinkedList<T>::reverseList() nodePtr->next = previous; nodePtr = previous; previous = nodePtr; } -
evanpurkhiser revised this gist
Sep 10, 2012 . 1 changed file with 11 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,26 +1,25 @@ template <typename T> void LinkedList<T>::reverseList() { ListNode<T> *nodePtr; nodePtr = head->next; ListNode<T> *previous; previous = head; ListNode<T> *temp = nodePtr; head->next = NULL; while(temp != NULL) { temp = nodePtr->next; nodePtr->next = previous; previous = nodePtr; } head = nodePtr; } -
ryanbrosnahan created this gist
Sep 10, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ template <typename T> void LinkedList<T>::reverseList() { ListNode<T> *nodePtr; //to traverse the front nodePtr = head->next; ListNode<T> *previous; //to traverse the end previous = head; ListNode<T> *temp = nodePtr; while(temp != NULL) { std::cout << temp->value << ", "; nodePtr->next = previous; temp = temp->next; } head = temp; temp->next = nodePtr; }