class Deque { struct Node { Element data; Node *next; Node *prev; Node(Element x, Node n, Node p): data = x, *next = n, *prev = p; } public: Deque() { *head = Node(x, NULL, *tail) //head's prev element is tail *tail = Node(x, *head, NULL) //tail's next element is head } void push(Element & x) { Node n = Node(x, NULL, NULL); n -> *prev = *head; *head -> *next = n; *head = n; //sets new head of deque to thing we're inserting } Element pop() { Node n = *head; *head = *head -> *prev; *head -> *next -> *prev = NULL; //clears out reference to thing we're popping *head -> *next = NULL; return n -> data; } void inject(Element & x) { Node n = Node(x, NULL, NULL); n -> *next = *tail; *tail -> *prev = n; *tail = n; } Element eject() { Node n = *tail; *tail = *tail -> *next; *tail -> *prev -> *next = NULL; *tail -> *prev = NULL; return n -> data; } private: Node *head; Node *tail; } We chose Lee's code because: -It was readable -It was already very close to compilable C++ code (not really abstract pseudocode) -It made use of pointers to a "head" and a "tail" -It also made use of the idea of linked nodes -Made a constructor for Node (sets defaults for *next and *prev) -We felt it was representative of all the of the groups' solutions