Algorithms Lab
Algorithms course tools. Enter a recurrence, a set of symbol frequencies or keys to insert, and follow each step to the answer.
Graph searches, shortest paths and spanning trees
Edit a weighted graph and trace BFS, DFS, Dijkstra, Bellman-Ford, Prim, Kruskal and topological sort with queues and vertex states.
1. Recurrences
Solve divide-and-conquer recurrences with the master theorem, then compare growth functions and modeled work at a chosen input size.
2. Coding and hashing
Build Huffman trees and codes from frequencies, and insert keys into a hash table to watch collisions and probing.
3. Dynamic programming
Fill knapsack, LCS, edit distance and minimum coin change tables cell by cell, then trace one optimal solution.
4. Number theory and modular arithmetic
Calculate modular inverses with extended Euclid, modular powers with repeated squaring, and GCD or LCM.
5. Sorting traces
Compare sorting passes, key comparisons, swaps and array writes, including Lomuto and Hoare quick sort.
Other labs
Frequently asked questions
Does the Huffman tool show the tree?
Yes. It merges the two least frequent nodes at each step, shows the finished tree and the code for every symbol, and counts the bits saved.
Which master theorem cases are handled?
The three standard cases for T(n) = aT(n/b) + f(n), with the comparison that decides the case shown in the working.