How arrays, linked lists, trees, graphs and hash tables organize data in memory, what each operation costs, and when to pick one structure over another.
Articles
14
Reading time
~4 h
Expanding your solution toolkit
Knowing data structures widens the range of solutions you can reach for. Software always deals with data, and choosing how to organize it is often a good place to start. The good old array solves most problems, but sometimes you need something else.
Why data structures matter
Performance: The wrong structure turns instant operations into ones too slow for production
Scalability: Code that works locally can fail with real data if the structure doesn't scale
Resource consumption: Memory and CPU are finite, and the structure defines how much you need of each
Maintainability: Appropriate structures make code simpler and bugs easier to find
The goal is to build the intuition to pick a structure based on what your problem actually needs.
What you'll learn
Each article in this category covers:
How the structure organizes data in memory
Available operations and their time/space complexities
When to choose it over alternatives
Real-world applications and common pitfalls
Articles
01/ 14
Introduction to Data Structures
Learn how data structures organize bytes: ADTs and concrete structures, contiguous and scattered memory, linear and non-linear, and the tradeoffs between them.
4 minutes read
02/ 14
Arrays
How arrays store elements in contiguous memory, why indexing takes constant time, and what inserting, deleting or growing an array costs in practice.
13 minutes read
03/ 14↳Arrays
Arrays: Go vs JavaScript
Why Go makes you declare an array's size and JavaScript doesn't. Compare memory footprints with Uint32Array and see what JavaScript trades for convenience.
15 minutes read
04/ 14
Linked Lists
How linked lists give up index access for cheap insertion, with node structure, pointer updates, singly vs doubly linked, and when a list beats an array.
14 minutes read
05/ 14
Stacks
How a stack keeps LIFO order with push, pop and peek, how to build one on an array or a linked list, and where stacks show up, from function calls to undo.
13 minutes read
06/ 14
Queues
How queues keep FIFO order, with enqueue, dequeue and peek, circular buffer and linked list implementations, and why task scheduling and BFS use them.
11 minutes read
07/ 14
Hash Tables
How hash tables get O(1) average lookups by mapping keys to array slots, covering hash functions, chaining, open addressing, load factor and rehashing.
33 minutes read
08/ 14
Trees
How trees organize data with one parent per node: root, depth and height, why V nodes always have V-1 edges, and how Go represents children in memory.
16 minutes read
09/ 14↳Trees
Binary Trees
What the two-child limit gives you: full, complete, perfect, balanced and degenerate shapes, why height sets the cost, and how a binary tree fits in an array.
16 minutes read
10/ 14↳Trees
Binary Search Trees
How one ordering rule turns a binary tree into a search structure: the recursive invariant, search, insert, the three delete cases, and why sorted input hurts.
15 minutes read
11/ 14↳Trees
Balanced Trees
How rotations put a floor under a binary search tree, with the balance factor, AVL's four cases, why libraries chose red-black, and what balancing costs.
16 minutes read
12/ 14↳Trees
Heap
A heap answers "what is the smallest right now" with a weak invariant. The Priority Queue ADT, sifting up and down, the array layout and an O(n) build-heap.
24 minutes read
13/ 14↳Trees
Trie
How a trie, or prefix tree, stores keys as paths of characters: insert, search and startsWith in O(k), deletion, memory per node and radix trees in Go.
15 minutes read
14/ 14
Graphs
How graphs model relationships between nodes, from directed, weighted and cyclic graphs to how adjacency lists and matrices trade space for lookup speed in Go.