Complete Algorithm Notes
Complete Algorithm Notes
Summary: Covers algorithm definitions, time & space complexity, tradeoffs, asymptotic notations
(Big-O, Omega, Theta), recurrence relations and their solutions, and the Divide and Conquer
approach. Includes code tuning techniques like loop, data, and logic optimization.
Topics Covered: Time and Space Complexity, Time-Space Tradeoff, Asymptotic Notation (Big-O,
Theta, Omega), Recurrence Relations and Solving Techniques, Divide and Conquer Strategy,
Examples: Binary Search, Merge Sort, Quick Sort, Heap Sort, Strassens Matrix Multiplication, Code
Summary: Explores greedy method algorithms that make locally optimal choices. Includes problems
like optimal merge patterns, Huffman coding, MSTs using Kruskal/Prim, job sequencing, knapsack,
Topics Covered: Greedy Strategy, Optimal Merge Pattern, Huffman Coding, Minimum Spanning
Tree (Kruskal & Prim), Knapsack Problem, Job Sequencing with Deadlines, Single Source Shortest
Summary: Dynamic programming solves overlapping subproblems and stores results to avoid
recomputation. Used for 0/1 Knapsack, multistage graphs, reliability design, and all-pairs shortest
paths (Floyd-Warshall).
Topics Covered: Dynamic Programming Concept, 0/1 Knapsack Problem, Multistage Graph
Summary: Backtracking explores all possible solutions by building candidates and abandoning
invalid ones. Branch & Bound improves it by pruning paths using bounds. Also covers lower bound
Topics Covered: Backtracking Concepts, 8 Queens Problem, Hamiltonian Cycle, Graph Coloring,
Branch and Bound, Travelling Salesman Problem, Lower Bound Theory, Parallel Algorithms
Introduction
Pseudocode:
GraphColoring(graph, m):
color[] = array of 0s
if solve(graph, m, color, 0):
print color
else:
print "No solution"
Topics Covered: Advanced Tree and Graph Algorithms, NP-Hard and NP-Complete Problems,
Approximation Algorithms, Data Stream Algorithms, Parallel Algorithm Design and Complexity
Pseudocode:
ApproxTSP(graph):
MST = Prim(graph)
PreorderTraversal(MST) to get tour
return tour with approximate cost