Glossary · Phase 7 · Software engineering
Linked list
A chain of small objects, each holding one item and a pointer to the next one.
A treasure hunt works differently from a row of seats. Each clue can be anywhere, and it tells you where the next clue is. A linked list stores each item in its own small object, a node, along with a pointer to the next node. The nodes can live anywhere in memory.
Try it now
Each new node points at the old head, so adding at the front never moves anything. Notice the printed order: the last item added comes first.
Learn it properly
Core data structures · Arrays, linked lists, stacks, queues and the hash table behind every dict. About 35 minutes.
Other terms from the same lesson
- hash table: A structure that turns a key into a slot number, so it can store and find values in about one step. Dicts and sets use one.
- queue: A line of items where the first one added is the first one removed: first in, first out.
- stack: A pile of items you add to and take from at the top only: last in, first out.
Never trained an AI?
Teach a small one to write, right in your browser. It takes about 20 seconds and needs no account.