Node-based data structures

Node-based data structures don't take contiguous blocks of memory. A node-based data structure allocates nodes for its elements without any order – they might be spread randomly in memory. We express each item as a node linked to the other nodes.

The most popular and introductory node-based data structure is the linked list. The following diagram shows the visual structure of a doubly linked list:

A linked list is very different from a vector. Some of its operations are faster, though it lacks the compactness of a vector.

To keep it short, let's implement the element insertion at the front of the list. We will keep ...

Get Expert C++ 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.