Starting in 1996, Alexa Internet has been donating their crawl data to the Internet Archive. Flowing in every day, these data are added to the Wayback Machine after an embargo period.
Starting in 1996, Alexa Internet has been donating their crawl data to the Internet Archive. Flowing in every day, these data are added to the Wayback Machine after an embargo period.
TIMESTAMPS
The Wayback Machine - https://web.archive.org/web/20140306145414/http://www.martinbroadhurst.com:80/articles/deque.html
A deque or double-ended queue is a data structure that allows efficient addition and removal at either end.
It may also support accessing elements by index, as this implementation does.
This deque is implemented as a dynamic array of fixed-size arrays.
The first array is filled from right to left, and the last one from left to right, as shown in the following diagram:
Creation
Create a deque with MBdeque_create.
Adding elements
Add at the head with MBdeque_push_front, and add at the tail with MBdeque_push_back.
Removing elements
Remove from the head with MBdeque_pop_front, and remove from the tail with MBdeque_pop_back.
Accessing elements
Access elements by array index using MBdeque_get_at and MBdeque_set_at.
Look at the first and last elements with MBdeque_peek_front and MBdeque_peek_back.
Get an iterator over the elements with MBdeque_iterator.
for (i = 0; i < n; i++) {
addfn(deque, elements[i]);
}
printf("front is %s, back is %s\n", (constchar *)MBdeque_peek_front(deque), (constchar *)MBdeque_peek_back(deque));
it = MBdeque_iterator(deque); while ((data = MBiterator_get(it))) {
printf("%s\n", (constchar*)data);
}
putchar('\n');
MBiterator_delete(it);
for (i = 0; i < n; i++) {
data = removefn(deque);
printf("%s\n", data ? (constchar*)data : "NULL");
}
putchar('\n');
}
int main(void)
{
addfn addfns[] = { MBdeque_push_back, MBdeque_push_front };
removefn removefns[] = { MBdeque_pop_back, MBdeque_pop_front }; constunsignedint nfns = sizeof(addfns) / sizeof(addfn);
MBdeque * deque = MBdeque_create(); unsignedint a, r; for (a = 0; a < nfns; a++) { for (r = 0; r < nfns; r++) {
test(deque, addfns[a], removefns[r]);
}
}
MBdeque_delete(deque);