{"id":760,"date":"2015-12-09T16:00:06","date_gmt":"2015-12-09T13:00:06","guid":{"rendered":"https:\/\/sobbayi.com\/?p=760"},"modified":"2015-12-09T16:00:06","modified_gmt":"2015-12-09T13:00:06","slug":"the-cpp-standard-template-library-linked-lists-and-deques-part-3","status":"publish","type":"post","link":"http:\/\/local.brightwhiz\/the-cpp-standard-template-library-linked-lists-and-deques-part-3\/","title":{"rendered":"The C++ Standard Template Library Linked List and Deque – Part 3"},"content":{"rendered":"

In this 3rd part of the C++ Standard Template Library tutorial we pick up from our previous article on Sequence Containers that focused mostly on the Vector<\/a>. This tutorial builds on that content and adds the Linked list and the Deque.<\/p>\n

Before we jump in to discuss the Linked list and the Deque, if you missed the beginning of this programming tutorial series then you might want to go back and read on the overview of the C++ Standard Template Library<\/a>.Before we take a look at the Linked List which comes in the form of a list and a forward list. We want to keep things much simpler than they already are. So we will go ahead and discuss the Deque first then come back to the Linked list.<\/p>\n

Deque<\/h2>\n

Deque so happens to be very similar in implementation to the vector with the major difference being one. The vector grows in one direction, which is the back while the deque can grow either in the front or the back ends.<\/p>\n

Deque also has similar interfaces to the vector. It has fast inserts and removes at the beginning and the end. It comes with slow inserts and removes in the middle of the container and slow search.<\/p>\n

Below is an example implementation of the deque in code.<\/p>\n