-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
The C++ Programmer's Mindset
By :
A linked list is another fundamental data structure in computing, generally coming in two flavors: singly linked and doubly linked. A linked list is a collection of nodes, each containing some data and a pointer to the next node in the list, as illustrated in Figure 5.1. Each node in a doubly linked list also contains a pointer to the previous entry in the list. This offers a great deal of flexibility. The data in each node is independent of its position in the list; new insertions only require modification to the pointers in the node and not the data itself. Insertions at a known point in the list (such as at the beginning or end) are also very cheap, as they only involve modifying the pointers in the surrounding nodes (if there are any).

Figure 5.1: A linked list with three nodes. Each node contains pointers to the previous and next node in the list, which could be null if no such node exists, indicated here by missing arrows. Each node also contains user data...