1. Home
  2. Design & Analysis of Algorithms

Design & Analysis of Algorithms

Step-by-step recipes for solving problems efficiently: sorting, searching, graphs, greedy algorithms, dynamic programming and backtracking — with their time complexity.

3DBeginner✓ Learned

Binary Search

Find any item in a sorted list of a million in about 20 steps by halving the search space every time. Watch it in 3D.

9 min · Interactive
3DBeginner✓ Learned

Bubble Sort

The simplest sorting algorithm — compare neighbours, swap if they're out of order, repeat. Watch the big values bubble to the end in 3D.

8 min · Interactive
3DBeginner✓ Learned

Selection Sort

Find the smallest value, swap it to the front, repeat. Always O(n²) comparisons, but never more than n − 1 swaps.

8 min · Interactive
3DBeginner✓ Learned

Insertion Sort

Sort the way you sort playing cards — pick up one card at a time and slide it into place. Fast on almost-sorted data.

8 min · Interactive
3DIntermediate✓ Learned

Merge Sort

Divide and conquer in action. In 3D, every level of recursion literally steps towards you — then the pieces merge back in sorted order.

12 min · Interactive
3DIntermediate✓ Learned

Quick Sort

Pick a pivot, split the array into "smaller" and "bigger", and the pivot lands in its final spot. See the partition happen in 3D.

13 min · Interactive
3DIntermediate✓ Learned

Heap Sort

Build a max-heap, then repeatedly move the biggest element to the end. Guaranteed O(n log n) with no extra memory — see the tree and the array change together.

11 min · Interactive
3DIntermediate✓ Learned

Counting Sort & Radix Sort

Sorting without comparing. Counting sort uses values as positions, and radix sort repeats it digit by digit, beating the O(n log n) limit.

12 min · Interactive
3DIntermediate✓ Learned

Graph Traversal — BFS & DFS

Two ways to explore every node of a graph. BFS spreads out like ripples using a queue; DFS dives deep like a maze explorer using a stack. Compare them on a real 3D graph.

14 min · Interactive
3DIntermediate✓ Learned

Topological Sort

Put tasks in an order that respects every "do this first" arrow. Kahn's algorithm and DFS both do it in O(V + E), and both catch cycles.

11 min · Interactive
3DAdvanced✓ Learned

Dijkstra's Shortest Path

How maps find the cheapest route. Watch distances shrink as Dijkstra's algorithm relaxes edges on a 3D weighted graph.

15 min · Interactive
3DAdvanced✓ Learned

Bellman–Ford Algorithm

Shortest paths even when some edges are negative. Relax every edge V − 1 times, then one extra pass catches negative cycles.

12 min · Interactive
3DIntermediate✓ Learned

Minimum Spanning Tree — Prim & Kruskal

Connect every node with the cheapest total edge weight. Compare Kruskal's "cheapest edge first" with Prim's "grow one tree" on a 3D graph.

14 min · Interactive
3DIntermediate✓ Learned

Floyd–Warshall (All-Pairs Shortest Paths)

Find the shortest distance between every pair of nodes with three simple loops. Watch the distance matrix improve as each node becomes an allowed stop-over.

12 min · Interactive
3DIntermediate✓ Learned

0/1 Knapsack (Dynamic Programming)

Choose items to maximise value without exceeding a weight limit. Watch the DP table fill up as a 3D bar chart and trace back the chosen items.

14 min · Interactive
3DIntermediate✓ Learned

Longest Common Subsequence (LCS)

Find the longest sequence of letters that appears, in order, in two strings. A classic dynamic programming problem behind diff tools and DNA comparison.

12 min · Interactive
3DAdvanced✓ Learned

Matrix Chain Multiplication

(AB)C and A(BC) give the same matrix but can cost very different amounts of work. Dynamic programming finds the cheapest brackets.

13 min · Interactive
3DIntermediate✓ Learned

Huffman Coding

Compress text by giving frequent characters short codes. Watch the greedy algorithm merge the two rarest groups again and again into a 3D tree.

12 min · Interactive
3DAdvanced✓ Learned

KMP String Matching

Find a pattern in a text without ever reading a character twice. The LPS table tells the pattern how far it can jump after a mismatch.

13 min · Interactive
3DIntermediate✓ Learned

N-Queens (Backtracking)

Place N queens on a chessboard so none attack each other. Watch backtracking try, fail and undo moves on a 3D board.

12 min · Interactive
3DIntermediate✓ Learned

Edit Distance (Levenshtein)

How many inserts, deletes and replacements turn one word into another? Fill a dynamic-programming table to find the minimum.

13 min · Interactive
3DBeginner✓ Learned

Activity Selection (Greedy)

Attend as many non-overlapping events as possible. Sort by finish time and always take the earliest finisher that fits.

10 min · Interactive

About Design & Analysis of Algorithms

An algorithm is a recipe, and the clearest way to understand one is to watch it work. Sort your own numbers with bubble, insertion, merge, quick and heap sort; trace BFS, DFS, Dijkstra, Prim, Kruskal and Floyd–Warshall on 3D graphs; and fill the dynamic-programming tables for knapsack and LCS cell by cell. Edit distance and activity selection show dynamic programming and greedy choices side by side. Each lesson explains the idea, its time complexity and when to use it.