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 ...