struct Node { Element data; Node * prev = NULL; Node * next = NULL; } Node first; // reference to the first (beginning) node of the Deque Node last; // reference to the last (end) node of the Deque // add node/element to front of queue void push ( Element D ) { Node temp; temp->data = D: temp->next = first->next; if ( first == last ){ last = temp; first = last; }else { first = temp; } } // remove first node of the Deque and return the element from that node Element pop() { if ( last == NULL && First == NULL ) return NULL; Node temp; temp = first; // store node first = first->next; // change pointer to next node return temp->data; } // add node to end of the Deque void inject ( Element D ) { Node temp; temp->data = D: temp->next = first->next; if ( first == last ){ last = temp; first = last; }else { first = temp; } } // remove last node of the Deque and return the content from that node Element eject() { if ( last == NULL && First == NULL ) return NULL; Node temp; temp = first; // store node first = first->next; // change pointer to next node return temp->data; }