Data Structures
Core Data Structures, Visualized
This is the largest topic in the curriculum, and the one where visualization pays off most. Pointer manipulation in a linked list, rotation in an AVL tree, relaxation in Dijkstra’s algorithm — these are all fundamentally spatial operations that textbooks are forced to render as prose.
The lessons run from the linear structures through trees and their balancing schemes to graphs and the traversal and shortest-path algorithms built on them. Together they cover the structures that the majority of interview questions are posed in terms of, and each one is something you can manipulate rather than only read about.
Interactive lessons
Free to open
Languages (JS, TS, Python, Java, C, C++)
Data Structures lessons
- StackFree
- QueueFree
- DequePro
- Circular QueuePro
- Priority Queue (ADT)Pro
- Tree TraversalPro
- Binary TreePro
- Binary Search TreePro
- AVL TreePro
- Trie (Prefix Tree)Pro
- Segment TreePro
- Fenwick TreePro
- Red-Black TreePro
- Singly Linked ListPro
- Doubly Linked ListPro
- Circular Linked ListPro
- Graph RepresentationFree
- Breadth First SearchFree
- Depth First SearchPro
- Topological SortPro
- Cycle DetectionPro
- Connected ComponentsPro
- Bipartite GraphPro
- Dijkstra's AlgorithmPro
- Bellman-Ford AlgorithmPro
- Minimum Spanning TreePro
- Floyd-Warshall AlgorithmPro
- Bridges & Articulation PointsPro
Data Structures time and space complexity compared
Best, average and worst-case running time and extra space for every data structures lesson, as each lesson derives them.
| Lesson | Best | Average | Worst | Space |
|---|---|---|---|---|
| Stack | O(1) | O(1) | O(1) | O(n) |
| Queue | O(1) | O(1) | O(1) | O(n) |
| Deque | O(1) | O(1) | O(1) | O(N) |
| Circular Queue | O(1) | O(1) | O(1) | O(N) |
| Priority Queue (ADT) | O(1) (Peek) | O(log N) (Insert/Delete) | O(log N) (Insert/Delete) | O(N) |
| Tree Traversal | O(n) | O(n) | O(n) | O(w) or O(h) |
| Binary Tree | O(1) | O(n) | O(n) | O(n) |
| Binary Search Tree | O(log n) | O(log n) | O(n) | O(n) |
| AVL Tree | O(log n) | O(log n) | O(log n) | O(n) |
| Trie (Prefix Tree) | O(L) | O(L) | O(L) | O(N * L) |
| Segment Tree | O(log n) | O(log n) | O(log n) | O(n) |
| Fenwick Tree | O(log N) | O(log N) | O(log N) | O(N) |
| Red-Black Tree | O(log n) | O(log n) | O(log n) | O(n) |
| Singly Linked List | O(1) | O(n) | O(n) | O(n) |
| Doubly Linked List | O(1) | O(n) | O(n) | O(n) |
| Circular Linked List | O(1) | O(n) | O(n) | O(n) |
| Graph Representation | O(1) | O(1) | O(V) | O(V + E) |
| Breadth First Search | O(V + E) | O(V + E) | O(V + E) | O(V) |
| Depth First Search | O(V + E) | O(V + E) | O(V + E) | O(V) |
| Topological Sort | O(V + E) | O(V + E) | O(V + E) | O(V + E) |
| Cycle Detection | O(V + E) | O(V + E) | O(V + E) | O(V) |
| Connected Components | O(V + E) | O(V + E) | O(V + E) | O(V) |
| Bipartite Graph | O(V + E) | O(V + E) | O(V + E) | O(V) |
| Dijkstra's Algorithm | O(E log V) | O(E log V) | O(E log V) | O(V + E) |
| Bellman-Ford Algorithm | O(E) | O(VE) | O(VE) | O(V) |
| Minimum Spanning Tree | Prim: O(E log V) | Kruskal: O(E log E) | Prim: O(E log V) | Kruskal: O(E log E) | Prim: O(E log V) | Kruskal: O(E log E) | O(V + E) |
| Floyd-Warshall Algorithm | O(V³) | O(V³) | O(V³) | O(V²) (Matrix) |
| Bridges & Articulation Points | O(V + E) | O(V + E) | O(V + E) | O(V) (DFS Stack + Arrays) |
Continue the DSA curriculum
Data Structures is one of 12 topics in the interactive DSA visualizer curriculum. Once this topic is comfortable, the coding interview pattern library reorganises the same material around the patterns interview questions are built on.
