Greedy Algorithms

Discover and visualize classic greedy algorithms. Click on any algorithm to learn more and interact with its visualization.

Kruskal's Algorithm

Finds the Minimum Spanning Tree of a graph by always choosing the smallest edge that doesn't form a cycle.

Visualize Kruskal's Algorithm

Prim's Algorithm

Builds a Minimum Spanning Tree by growing from a starting node, always adding the smallest edge to the tree.

Visualize Prim's Algorithm

Huffman Coding

Constructs an optimal prefix code for data compression using a greedy approach.

Visualize Huffman Coding

Activity Selection

Selects the maximum number of non-overlapping activities by always picking the next activity that finishes earliest.

Visualize Activity Selection