Each of the following member functions has errors in the way it performs a linked list operation. Find as many mistakes as you can.
void NumberList::deleteNode(double num)
{
ListNode *nodePtr, *previousNode;
// If the list is empty, do nothing.
if (!head)
return;
// Determine if the first node is the one.
if (head–>value == num)
delete head;
else
{
// Initialize nodePtr to head of list.
nodePtr = head;
// Skip all nodes whose value member is
// not equal to num.
while (nodePtr–>value != num)
{
previousNode = nodePtr;
nodePtr = nodePtr–>next;
}
// Link the previous node to the node after
// nodePtr, then delete nodePtr.
previousNode–>next = nodePtr–>next;
delete nodePtr;
}
}