Tweak algorithm, no need to set the curr node as it is passed in. Added check for error cases.

This commit is contained in:
Donne Martin 2015-05-11 19:51:05 -04:00
parent 9077387653
commit 202599fe0c

View File

@ -45,7 +45,7 @@
"\n", "\n",
"We'll need two pointers, one to the current node and one to the next node. We will copy the next node's data to the current node's data (effectively deleting the current node) and update the current node's next pointer.\n", "We'll need two pointers, one to the current node and one to the next node. We will copy the next node's data to the current node's data (effectively deleting the current node) and update the current node's next pointer.\n",
"\n", "\n",
"* Set curr and next pointers\n", "* Check for error cases listed above\n",
"* set curr.data to next.data\n", "* set curr.data to next.data\n",
"* set curr.next to next.next\n", "* set curr.next to next.next\n",
"\n", "\n",