/** * Adds a new link with the given value to the front of the deque. */ void circularListAddFront(struct CircularList* list, TYPE value) { // FIXME: you must write this assert(list != 0); addLinkAfter(list, list->sentinel, value); }
/** * Adds a new link with the given value to the back of the deque. */ void circularListAddBack(struct CircularList* list, TYPE value) { // FIXME: you must write this assert(list != 0); if (list->sentinel->prev == 0) list->sentinel->prev->value = value; else addLinkAfter(list, list->sentinel->prev, value); }
/** * Creates a new link with the given value and inserts it at the back of the * deque. Also increments the size of the deque. * @param deque * @param value */ void dequePushBack(Deque* deque, Type value) { addLinkAfter(deque->sentinel->prev, value); ++(deque->size); }
/** * Creates a new link with the given value and inserts it at the front of the * deque. Also increments the size of the deque. * @param deque * @param value */ void dequePushFront(Deque* deque, Type value) { addLinkAfter(deque->sentinel, value); ++(deque->size); }