Homework/HW03/ListNode.cc
ListNode *ListNode::lastNode()
{
    ListNode *p = this;  // start from the current node
    while (p && p->next) // while we are not at the last node
        p = p->next;     // move forward
    return p;            // return the last node
}
// Returns the last node in a list starting from the target object.
Returns the last node in a list starting from the target object.
Returns the last node in a list starting from the target object .
ListNode *ListNode::lastNode()
{
    ListNode *p = this;  
    while (p && p->next) 
        p = p->next;     
    return p;            
}
ListNode * ListNode :: lastNode ( ) { ListNode * p = this ; while ( p && p -> next ) p = p -> next ; return p ; }
Returns the last node in a list starting from the target object.
Returns the last node in a list starting from the target object .
// start from the current node // while we are not at the last node // move forward // return the last node