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

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. Every lesson pairs the model with a plain-English explanation, pseudocode, Python and C++ code, a Big-O table and a short quiz.