โ Computer Science Fundamentals learning pathComputer Science Fundamentals ยท Module 4 of 10
Data structures
Data structures organise data so operations are fast.
๐ Key ideas
- Arrays give fast access by index; inserting in the middle is slow.
- Linked lists insert quickly but access by index is slow.
- Stacks are last-in first-out; queues are first-in first-out.
- Hash tables give average O(1) lookups by key.
- Trees and graphs model hierarchies and networks.
๐ก Real-life example: Like storage at home: a numbered shelf (array), a chain of boxes (linked list), a pile of plates (stack), a bus queue (queue).
StackLast in, first out
QueueFirst in, first out
Hash tableKey to value with fast lookup
GraphNodes connected by edges