Homework/HW02/List.cc
void List::insertFront(int number)
{
    // create a node with the data and pointing towards the head
    ListNodePtr newNode = new ListNode(number, head);
    testAllocation(newNode);

    size++; // we're adding a node

    head = newNode; // this one becomes the head of the list

    if (size == 1)      // if it was the first one
        tail = newNode; // then it's also the tail
}
// Inserts a new node with the specified content at the front of the
// list. It must make sure to update both the head and the tail of the
// list if need be.
Inserts a new node with the specified content at the front of the
list. It must make sure to update both the head and the tail of the
list if need be.
Inserts a new node with the specified content at the front of the list . It must make sure to update both the head and the tail of the list if need be .
void List::insertFront(int number)
{
    ListNodePtr newNode = new ListNode(number, head);
    testAllocation(newNode);
    size++; 
    head = newNode; 
    if (size == 1)      
        tail = newNode; 
}
void List :: insertFront ( int number ) { ListNodePtr newNode = new ListNode ( number , head ) ; testAllocation ( newNode ) ; size ++ ; head = newNode ; if ( size == 1 ) tail = newNode ; }
Inserts a new node with the specified content at the front of the
list.
Inserts a new node with the specified content at the front of the list .
// create a node with the data and pointing towards the head // we're adding a node // this one becomes the head of the list // if it was the first one // then it's also the tail