##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
Learn algorithms step-by-step. Each tutorial includes explanations, code implementations, and practice problems.
Bellman-Ford Algorithm
Breadth-First Search BFS
Bipartite Graph Check
Depth-First Search DFS
Dijkstra's Algorithm
Floyd-Warshall Algorithm
Kruskal's Algorithm
Prim's Algorithm
Topological Sort DFS-based
Topological Sort Kahn's Algorithm
A Strongly Connected Component SCC in a directed graph is a maximal set of vertices where every vertex is reachable from every other vertex.
Dynamic Programming: Memoization
Kadane's Algorithm
Unbounded Knapsack
Let be the number of ways to form sum using the coin types processed so far.
Edit Distance measures the minimum number of single-character operations needed to transform one string into another. You have operations available:
The Knapsack problem asks: given items, each with a weight and value, what's the maximum value you can carry in a bag with capacity ?
A subsequence is a sequence you can derive from another by deleting zero or more elements without changing the order of remaining elements. For example, "ACE"...
The Longest Increasing Subsequence LIS problem asks for the length of the longest subsequence where each element is strictly greater than the previous one.
Let be the minimum number of coins needed to make sum . The answer is built from smaller sums.
Factorial with Modular Arithmetic
Euclidean Algorithm for GCD
Fast Exponentiation Binary Exponentiation
Sieve of Eratosthenes
Binomial Coefficient nCr mod p
Modular Multiplicative Inverse
Binary search is a fast algorithm for finding a target value in a sorted array. Instead of checking every element like linear search at , you repeatedly split...
A lower bound query asks for the first sorted element that is at least a target value. The array is already sorted, so binary search is the natural tool.
The answer is a distance. If it is possible to place all items with minimum distance , then every smaller distance is also possible.
The answer is a time. If the machines can produce enough items by time , then any larger time also works.
The answer is the largest allowed segment sum. If a limit works, then any larger limit also works.