1. Home
  2. Data Structures

Data Structures

How data is organised in memory — arrays, stacks, queues, linked lists, trees, heaps, hash tables and graphs — and why the right structure makes programs fast.

3DBeginner✓ Learned

Arrays & Strings

The most basic data structure — a row of boxes in memory. See why reading any element is instant but inserting in the middle is slow.

10 min · Interactive
3DBeginner✓ Learned

Stack

A pile of plates you can only touch from the top. Learn push, pop and peek — and why all three are O(1).

8 min · Interactive
3DBeginner✓ Learned

Queue

First come, first served. See how enqueue and dequeue work — and why the circular queue is so clever.

9 min · Interactive
3DBeginner✓ Learned

Linked List

A chain of nodes connected by pointers. Watch insertion, deletion and the famous "reverse a linked list" happen one arrow at a time.

12 min · Interactive
3DIntermediate✓ Learned

Binary Search Tree (BST)

A tree where smaller values go left and bigger values go right — so every search throws away half of the tree. Insert, search, delete and traverse it in 3D.

14 min · Interactive
3DIntermediate✓ Learned

Binary Heap & Priority Queue

A tree that always keeps the smallest value on top — stored secretly inside a plain array. See both views change together in 3D.

12 min · Interactive
3DIntermediate✓ Learned

Hash Table

The data structure behind dictionaries and maps — find anything in O(1) on average. See hashing, collisions, chaining and linear probing in 3D.

13 min · Interactive
3DIntermediate✓ Learned

Trie (Prefix Tree)

A tree that stores words letter by letter, so words with the same beginning share a path. The secret behind autocomplete.

11 min · Interactive
3DAdvanced✓ Learned

AVL Tree

A binary search tree that rebalances itself with rotations, so it never becomes a slow straight line. Watch LL, RR, LR and RL rotations in 3D.

15 min · Interactive
3DAdvanced✓ Learned

Red-Black Tree

A self-balancing BST that colours every node red or black. Insertions fix themselves with a recolouring or at most two rotations.

14 min · Interactive
3DAdvanced✓ Learned

Segment Tree

Answer "what is the sum of a[l..r]?" in O(log n) — even while the array keeps changing. Build, query and update it in 3D.

14 min · Interactive
3DAdvanced✓ Learned

Fenwick Tree (Binary Indexed Tree)

Prefix sums and single-element updates, both in O(log n), using one array and the lowest set bit of each index.

12 min · Interactive
3DIntermediate✓ Learned

Disjoint Set (Union–Find)

Keep track of which items belong to the same group — and merge groups — in almost constant time. See union by rank and path compression in 3D.

12 min · Interactive
3DBeginner✓ Learned

Graph Representation

How a computer actually stores a graph. Compare the adjacency matrix and the adjacency list side by side as you add edges.

10 min · Interactive
3DIntermediate✓ Learned

Monotonic Stack (Next Greater Element)

Keep a stack in sorted order and answer "what is the next bigger value?" for every element in a single pass.

11 min · Interactive
3DIntermediate✓ Learned

Bloom Filter

A tiny bit array that says "definitely not here" or "probably here". It saves huge amounts of memory at the price of rare false positives.

12 min · Interactive
3DBeginner✓ Learned

Recursion & the Call Stack

How does a function that calls itself keep track of everything? Watch stack frames pile up and pop off for factorial and Fibonacci in 3D, next to the tree of calls, and see memoisation cut the work.

13 min · Interactive
3DBeginner✓ Learned

Binary Tree Traversals

Pre-order, in-order, post-order and level-order in one place. Walk around a tree in 3D and see that the three depth-first orders are the same walk, written down at different moments, then turn an expression tree into prefix, infix and postfix notation.

13 min · Interactive
3DIntermediate✓ Learned

LRU Cache (Hash Map + Doubly Linked List)

Keep the most recently used items and evict the least recently used one, with get and put in O(1). See how a hash map and a doubly linked list work together in 3D, step by step through the classic example.

13 min · Interactive
3DIntermediate✓ Learned

B-Tree

A search tree with many keys per node that stays perfectly balanced. Insert keys into a B-tree of order 3, 4 or 5 in 3D, watch full nodes split and push their middle key up, and search it level by level.

15 min · Interactive
3DBeginner✓ Learned

Two Pointers & Sliding Window

Turn O(n²) array and string problems into O(n) with two indices that only move forward. Watch two pointers find a pair with a given sum, a fixed window slide to the largest sum, and a growing window find the longest substring without repeats.

13 min · Interactive

About Data Structures

Data structures decide how fast a program can be. Each lesson turns one structure into a 3D model you operate yourself: push onto a stack, enqueue into a circular queue, rotate an AVL tree, hash keys into buckets or query a segment tree, and watch memory change one step at a time. A monotonic stack and a Bloom filter show two clever tricks built from simple parts. Watch the call stack grow and shrink during recursion, walk a binary tree in pre-, in-, post- and level order, build an LRU cache from a hash map and a linked list, split the nodes of a B-tree, and solve array problems in O(n) with two pointers and sliding windows. Every lesson pairs the model with a plain-English explanation, pseudocode, Python and C++ code, a Big-O table and a short quiz.