Consuming the Deque ADT

We are going to create a deque containing the elements shown in the preceding diagram. Since the Deque data type is similar to the Queue data type, we are going to use the Back() operation to peek at the element's value. The elements' value will be displayed from back to front. The code will be as follows:

// Project: Deque.cbp// File : main.cpp#include <iostream>#include "Deque.h"using namespace std;int main(){    // NULL    Deque<int> deque = Deque<int>();    // Enqueue several numbers to the deque    // 26    deque.EnqueueFront(26);    // 26 - 78    deque.EnqueueBack(78);    // 26 - 78 - 44    deque.EnqueueBack(44);    // 91 - 26 - 78 - 44    deque.EnqueueFront(91);    // 35 - 91 - 26 - 78 - 44    deque.EnqueueFront(35); // 35 - 91 - 26 - 78 - 44 - 12 ...

Get C++ Data Structures and Algorithms now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.