A+DS
See algorithms come alive. Interactive visualizations, step-by-step walkthroughs, and editorial-grade design — built for students.
Start LearningA+DS
See algorithms come alive. Interactive visualizations, step-by-step walkthroughs, and editorial-grade design — built for students.
Bubble Sort — live
Explore Algorithms
Dive into interactive visualizations with synced pseudocode, step-by-step controls, and complexity analysis.
Sorting
Start: compare adjacent pairs
Bubble Sort — live
Bubble Sort
Compare adjacent elements and swap. Watch values bubble up to their correct positions.
O(n²) · Stable
First element is trivially sorted
Insertion Sort — live
Insertion Sort
Build a sorted array one element at a time by inserting each into its correct position.
O(n²) · Stable
Find minimum, swap to front
Selection Sort — live
Selection Sort
Find the minimum element and swap it to the front. Repeat for the unsorted portion.
O(n²) · Unstable
Divide array in half recursively
Merge Sort — live
Merge Sort
Divide the array in half, sort each half, then merge them back together.
O(n log n) · Stable
Choose pivot (last element)
Quick Sort — live
Quick Sort
Pick a pivot, partition elements around it, then recurse on both sides.
O(n log n) · Unstable
Build max-heap from array
Heap Sort — live
Heap Sort
Build a max-heap, then repeatedly extract the maximum to sort the array.
O(n log n) · Unstable
Graph
Start at node 0, enqueue it
BFS — live
BFS
Breadth-First Search explores all neighbors at the current depth before moving deeper.
O(V + E) · Queue
Start at node 0, push to stack
DFS — live
DFS
Depth-First Search explores as deep as possible before backtracking.
O(V + E) · Stack
Source A: dist=0, all others=∞
Dijkstra — live
Dijkstra
Find the shortest path from a source to all nodes in a weighted graph.
O((V+E) log V) · Greedy
Find nodes with in-degree 0: A, B
Topo Sort — live
Topological Sort
Order nodes in a DAG so every edge goes from earlier to later in the ordering.
O(V + E) · Kahn's
Tree
Insert 50 as root
BST Insert — live
BST
Binary Search Tree — insert and delete values while maintaining the BST property.
O(log n) avg · O(n) worst
Insert 30, 20, 10 — left-heavy!
AVL Rotation — live
AVL Tree
Self-balancing BST with automatic rotations. Guarantees O(log n) height at all times.
O(log n) · Self-balancing
Array: [1, 3, 5, 7, 9, 11]
Seg Tree — live
Segment Tree
Efficient range queries and point updates on an array. Build, query, and update in O(log n).
O(log n) · Range Queries
Insert 20 as BLACK root
RB Insert — live
Red-Black Tree
Self-balancing BST with red/black coloring. Guarantees O(log n) via recoloring and rotations.
O(log n) · Color Rules
Hashing
Empty table of size 7
Linear Probing — live
Linear Probing
Hash table with linear probing — resolve collisions by checking the next slot sequentially.
O(1) avg · O(n) worst
Empty table of size 7
Quadratic Probing — live
Quadratic Probing
Hash table with quadratic probing — resolve collisions by jumping 1², 2², 3² slots ahead.
O(1) avg · Less clustering