Exemplo n.º 1
0
/**
 * 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);
	
}
Exemplo n.º 2
0
/**
 * 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);
}
Exemplo n.º 3
0
/**
 * 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);
}
Exemplo n.º 4
0
/**
 * 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);
}