linked_list/linked_list/LinkedList.cpp
// add item to the front of list
add item to the front of list
add item to the front of list
void LinkedList::push_front(int value) {
    Node *newNode = new Node;
    (*newNode).value = value;
    if (!this->empty()) {
        (*newNode).next = this->head;
    } else {
        (*newNode).next = NULL;
    }
    this->head = newNode;
    this->itemsAmount++;
}
void LinkedList :: push_front ( int value ) { Node * newNode = new Node ; ( * newNode ) . value = value ; if ( ! this -> empty ( ) ) { ( * newNode ) . next = this -> head ; } else { ( * newNode ) . next = NULL ; } this -> head = newNode ; this -> itemsAmount ++ ; }
add item to the front of list
add item to the front of list