Skip to Content
C++ Data Structures and Algorithms
book

C++ Data Structures and Algorithms

by Wisnu Anggoro
April 2018
Intermediate to advanced content levelIntermediate to advanced
322 pages
6h 57m
English
Packt Publishing
Content preview from C++ Data Structures and Algorithms

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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Data Structures and Algorithms Using C++

Data Structures and Algorithms Using C++

Ananda Rao Akepogu, Radhika Raju Palagiri
C++ Data Structures and Algorithm Design Principles

C++ Data Structures and Algorithm Design Principles

John Carey, Anil Achary, Shreyans Doshi, Payas Rajan
C++ Plus Data Structures, 6th Edition

C++ Plus Data Structures, 6th Edition

Nell Dale, Chip Weems, Tim Richards

Publisher Resources

ISBN: 9781788835213Supplemental Content