Each record in the list is called a node.
Each node has a field which is a pointer to the next node in the linked list (ie its
address). The last node has a null pointer.
There is a Start Pointer which links to the first node of the list.
There may also be a Next Free Pointer giving the address of the next free record space.
Graphical representation of a Linked List :
The advantage of a
linked list is that the nodes can be accessed in order, even though they are
not stored in order.
Example:
The linked list shown has been assigned
pointers after a sorting process -
Address |
Town |
Pointer |
1 |
Bridgend |
4 |
2 |
Swansea |
5 |
3 |
Reading |
2 |
4 |
Cardiff |
3 |
5 |
Swindon |
0 |
6 |
|
|
7 |
|
|
8 |
|
|
Start Pointer = 1 |
By following the links, the records can be
accessed in alphabetical order.
|