Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
C++ Data Structures and Algorithms

You're reading from  C++ Data Structures and Algorithms

Product type Book
Published in Apr 2018
Publisher Packt
ISBN-13 9781788835213
Pages 322 pages
Edition 1st Edition
Languages
Author (1):
Wisnu Anggoro Wisnu Anggoro
Profile icon Wisnu Anggoro

Table of Contents (16) Chapters

Title Page
Copyright and Credits
Packt Upsell
Contributors
Preface
Learning Data Structures and Algorithms in C++ Storing Data in Lists and Linked Lists Constructing Stacks and Queues Arranging Data Elements Using a Sorting Algorithm Finding out an Element Using Searching Algorithms Dealing with the String Data Type Building a Hierarchical Tree Structure Associating a Value to a Key in a Hash Table Implementation of Algorithms in Real Life Other Books You May Enjoy Index

Building a Deque ADT


A dequeue, which stands for double-ended queue, is a queue that can insert and remove items from two sides: thefrontandback. To build this data structure, we are going to adopt theDoublyLinkedListdata type we already built in the previous chapter. Similar to the Queue data type, the Dequeue data type also has the Front() operation to fetch the front-most element's value. The Enqueue() operation in the Queue data type will become EnqueueBack() in the Dequeue data type, and the Dequeue() operation in the Queue data type will become DequeueFront() in the Dequeue data type. However, since we adopt the DoublyLinkedList data type instead of LinkedList, the implementation will be different. Besides those operations, we are also going to build the following operations:

  • The Back() operation to fetch the back-most element's value.
  • The EnqueueFront() operation to insert a new element into the front side. It will be similar to the implementation of the InsertHead() operation in the...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}