Huffman Trees and Codes
Suppose we have to encode a text that comprises symbols from some n-symbol…
Dijkstra’s Algorithm
In this section, we consider the single-source shortest-paths problem: for a given vertex…
Kruskal’s Algorithm
In the previous section, we considered the greedy algorithm that “grows” a…
Prim’s Algorithm
The following problem arises naturally in many practical situations: given n points, connect them…
Greedy Technique
Let us revisit the change-making problem faced, at least subconsciously, by millions of cashiers…
The Knapsack Problem and Memory Functions
We start this section with designing a dynamic programming algorithm for the…
Warshall’s and Floyd’s Algorithms
In this section, we look at two well-known algorithms: Warshall’s algorithm for…
Greedy approach vs Dynamic programming
A Greedy algorithm is an algorithmic paradigm that builds up a solution piece by…
Knapsack Problem
Here is another well-known problem in algorithmics. Given n items of known weights w1, w2,…
Exhaustive Search
Exhaustive Search: 1. Traveling Salesman Problem 2. Knapsack Problem 3. Assignment Problem…


