
Explore backtracking and its cousins from recursion and recurrence relations to dynamic programming, with emphasis on state-space trees, bounding functions, branch-and-bound, and problem types like decision, optimization, and enumeration.
Explore the knight's tour problem on a chessboard and implement a backtracking solution using eight knight moves, state space exploration, initialization, and a visited check to complete the tour.
Explore the m-coloring problem using backtracking to color a graph with given colors while enforcing that adjacent vertices have different colors; compare decision, optimization, and enumeration approaches.
Explore implementing a Hamiltonian cycle via backtracking in C, building a graph with an adjacency matrix, and using a solve function and a display function to show all solutions.
Explain the time and space complexity of a sudoku solver using backtracking, showing nine possibilities per empty cell and a time complexity of nine to the n, with constant space.
Explore the Sieve of Eratosthenes to find all primes up to a given number by selecting a base and eliminating its multiples, stopping at the square root.
Implement the sieve of Eratosthenes to generate primes by marking multiples up to the square root of n, starting at the square of each prime, and printing primes below n.
Learn the implementation of the sieve of Sundaram to generate primes. Follow elimination steps, index-value mapping, and final prime construction.
Use backtracking to find three prime numbers between two and S that sum to S, while generating prime numbers with the sieve of Eratosthenes and analyzing complexity.
Learn to implement a backtracking method that generates primes after a given prime and selects a subset whose sum matches the target, using linked lists, traversal, and recursive safety checks.
Analyze the time and space complexity of a prime-selection algorithm using recursion and loops. Derive a recurrence, solve by substitution, and discuss activation records and space bounds.
Implement the 0/1 knapsack problem with dynamic programming using a (n+1) by (W+1) DP matrix. Read item values and weights, then apply the max transition to compute the optimal value.
Trace the dynamic programming matrix to print the selected items in the 0/1 knapsack problem, starting from the last column and moving upward to reveal chosen weights and values.
Uncover the minimum cost path using dynamic programming on a cost matrix, handling rectangular grids and moves only down or right from (0,0) to (m-1,n-1).
Explore the subset sum problem for non-negative integers using dynamic programming, building a (n+1) by (sum+1) DP matrix to decide if a subset sums to the target.
Reconstruct a subset that sums to the target in the subset sum problem using a dynamic programming table, tracing from top to bottom.
Implement the longest increasing subsequence with dynamic programming. Initialize dp[i] to 1, read the input sequence, update dp[i] using dp[j]+1 when a[j] < a[i], and print dp.
Learn to implement the longest common subsequence by building a dp matrix, filling base zeros, and using max of top and left, with diagonal increment on character matches.
Trace the longest common subsequence from the dynamic programming matrix, matching diagonally on equal characters and taking the max of top or left on mismatches, with backtracking for enumeration.
Implement tracing the longest common subsequence using a dynamic programming matrix, reconstruct the subsequence by following top, left, and diagonal moves, and reverse the result for correct order.
Explore the brute-force range minimum query by selecting a start and end index, iterating through the range, updating the minimum, and printing the result.
Learn how to construct a segment tree by recursively splitting an array into halves, building leaf nodes from input elements, and storing minimums at internal nodes.
Implement range minimum query using a sparse table, including preprocessing with logarithms and power-of-two intervals, then answer queries efficiently. Compare brute-force and dynamic programming approaches.
Learn to represent graphs with adjacency lists for directed and undirected graphs, using an array of linked lists to store adjacent vertices, with proper memory management and source–destination concepts.
This lecture covers Hierholzer's algorithm to find an Eulerian circuit in a directed graph, outlining conditions of strong connectivity and equal in and out degrees, and describing a stack-based process.
Explore the Bellman-Ford algorithm for single-source shortest paths, including edge relaxation over B−1 iterations, handling negative weights, and detecting negative cycles with an extra pass.
Learn how Prim's algorithm builds a minimum spanning tree using a binary heap, a hash map for vertex indexing, and priority queue, with insert, extract minimum, contains, and decrease operations.
An algorithmic paradigm or algorithm design paradigm is a generic model or framework which underlies the design of a class of algorithms. An algorithmic paradigm is an abstraction higher than the notion of an algorithm, just as an algorithm is an abstraction higher than a computer program.
How does one calculate the running time of an algorithm?
How can we compare two different algorithms?
How do we know if an algorithm is `optimal'?