Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Deque v. Doubly Linked List

This thread is locked; no one can reply to it. rss feed Print
Deque v. Doubly Linked List
Jeff Bernard
Member #6,698
December 2005
avatar

So I've got this assignment to write various data structures. No big deal. I've just got one more to write, a Doubly Linked List. But wait, I already wrote a Deque... aren't those pretty much the same thing or am I missing something?

According to the assignment, both data structures hold a node which in turn points to the nodes before and after it. It seems as if the only difference is the fact that I'm supposed to write more methods for the Doubly Linked List.

--
I thought I was wrong once, but I was mistaken.

netcat
Member #6,097
August 2005

Basically, a dequeue only allows insertion (and deletion) at the front and back, while a list allows insertion in the middle of it.

kazzmir
Member #1,786
December 2001
avatar

A dequeue implies the operations that can be performed on it, push/pop from either end. A doubly linked list implies the structure of the data. You can implement a dequeue with a doubly linked list, but not the other way around.

Jeff Bernard
Member #6,698
December 2005
avatar

Alright, then I guess they're pretty much the same for this assignment since it had me write a method to insert into the middle of the deque (and since I used a doubly linked list to write it).

Thanks.

--
I thought I was wrong once, but I was mistaken.

Go to: