Design and Analysis of Algorithms - Notes
Module 1: Introduction
- Characteristics of Algorithms: Input/Output, Definiteness, Finiteness, Effectiveness.
- Asymptotic Analysis: Big O (worst), Omega (best), Theta (average).
- Time & Space Trade-offs.
- Solving Recurrences:
- Substitution Method
- Recursion Tree Method
- Master's Theorem: T(n) = aT(n/b) + f(n)
Module 2: Fundamental Algorithmic Strategies
- Brute Force: Try all possibilities.
- Greedy: Locally optimal choices (e.g., Prim's, Kruskal's).
- Dynamic Programming (DP): Store subproblem results (e.g., Knapsack).
- Branch and Bound: Optimization (e.g., TSP).
- Backtracking: Recursive solution pruning (e.g., N-Queens).
Module 3: Graph and Tree Algorithms
- Traversals: DFS (deep first), BFS (level by level).
- Shortest Paths: Dijkstra's (non-negative), Bellman-Ford (handles negatives).
- MST: Kruskal's (edge-based), Prim's (node-based).
- Topological Sort: For DAGs, task ordering.
- Transitive Closure: Reachability via Floyd-Warshall.
- Network Flow: Ford-Fulkerson for max flow.
Module 4: Tractable and Intractable Problems
- Tractable (P): Solvable in polynomial time.
- Intractable (NP, NP-Complete, NP-Hard):
- NP: Verifiable in polynomial time.
- NP-Complete: Hardest in NP (e.g., SAT).
- NP-Hard: At least as hard as NP-Complete.
- Cook's Theorem: SAT is NP-Complete.
- Reductions: Proving problem hardness by transformations.
Module 5: Advanced Topics
- Approximation Algorithms: Near-optimal solutions, faster.
- Randomized Algorithms: Use randomness (e.g., QuickSort).
- Heuristics: Fast, rule-based (e.g., A* for pathfinding).