Lesson Objective
- Describe the linked list data structure.
- Show how to create, traverse, add data to and remove data from a linked list.
KS3, GCSE, A-Level Computing Resources
A linked list is a data structure that provides a foundation that other data structures can be built on such as stacks, queues, graph and trees.
It is a dynamic abstract data structure which can be implemented as an array.
Composed of “nodes”. Each node is composed of two parts:
A start pointer identifies the first node in the list.
A nextfree pointer shows the index of the next free space in the array.
This is a diagram of a linear linked list.
This is a diagram of a double linked list.
This is a diagram of a circular linked list.
RAM | Address | Data | Pointer |
---|---|---|---|
01 | |||
02 | |||
03 | Hat | null | |
04 | Dog | 03 | |
05 | Bat | 06 | |
06 | Cat | 04 | |
07 | |||
08 |
Linked lists can be used for:
RAM | Address | Data | Pointer |
---|---|---|---|
01 | # | # | |
02 | # | # | |
03 | Hat | null | |
04 | Dog | 03 | |
05 | Bat | 06 | |
06 | Cat | 04 | |
07 | |||
08 |
RAM | Address | Data | Pointer |
---|---|---|---|
01 | # | # | |
02 | # | # | |
03 | Hat | null | |
04 | Dog | 03 | |
05 | Bat | 06 | |
06 | Cat | 04 | |
07 | Gap | ||
08 |
RAM | Address | Data | Pointer |
---|---|---|---|
01 | # | # | |
02 | # | # | |
03 | Hat | null | |
04 | Dog | 03 | |
05 | Bat | 06 | |
06 | Cat | 04 | |
07 | Gap | ||
08 |
RAM | Address | Data | Pointer |
---|---|---|---|
01 | # | # | |
02 | # | # | |
03 | Hat | null | |
04 | Dog | 03 | |
05 | Bat | 06 | |
06 | Cat | 04 | |
07 | Gap | ||
08 |
RAM | Address | Data | Pointer |
---|---|---|---|
01 | # | # | |
02 | # | # | |
03 | Hat | null | |
04 | Dog | 03 | |
05 | Bat | 06 | |
06 | Cat | 04 | |
07 | Gap | 03 | |
08 |
RAM | Address | Data | Pointer |
---|---|---|---|
01 | # | # | |
02 | # | # | |
03 | Hat | null | |
04 | Dog | 07 | |
05 | Bat | 06 | |
06 | Cat | 04 | |
07 | Gap | 03 | |
08 |
RAM | Address | Data | Pointer |
---|---|---|---|
01 | # | # | |
02 | # | # | |
03 | Hat | null | |
04 | Dog | 03 | |
05 | Bat | 06 | |
06 | Cat | 04 | |
07 | |||
08 |
RAM | Address | Data | Pointer |
---|---|---|---|
01 | # | # | |
02 | # | # | |
03 | Hat | null | |
04 | Dog | 03 | |
05 | Bat | 06 | |
06 | Cat | 04 | |
07 | |||
08 |
RAM | Address | Data | Pointer |
---|---|---|---|
01 | # | # | |
02 | # | # | |
03 | Hat | null | |
04 | Dog | 03 | |
05 | Bat | 06 | |
06 | Cat | 04 | |
07 | |||
08 |
RAM | Address | Data | Pointer |
---|---|---|---|
01 | # | # | |
02 | # | # | |
03 | Hat | null | |
04 | Dog | 03 | |
05 | Bat | 04 | |
06 | Cat | 04 | |
07 | |||
08 |
RAM | Address | Data | Pointer |
---|---|---|---|
01 | # | # | |
02 | # | # | |
03 | Hat | null | |
04 | Dog | 03 | |
05 | Bat | 04 | |
06 | Cat | 07 | |
07 | |||
08 |
RAM | Address | Data | Pointer |
---|---|---|---|
01 | # | # | |
02 | # | # | |
03 | Hat | null | |
04 | Dog | 03 | |
05 | Bat | 04 | |
06 | Cat | 07 | |
07 | |||
08 |
RAM | Address | Data | Pointer |
---|---|---|---|
01 | |||
02 | |||
03 | Hat | null | |
04 | Dog | 03 | |
05 | Bat | 06 | |
06 | Cat | 04 | |
07 | |||
08 |