DSA & Algorithms
106 articles in this topic
Advanced Dynamic Programming: Mixed Problems, State Design and a GATE-Style Example
Learn how sorting, binary search and DP work together in weighted interval scheduling, then recover the chosen jobs and test the method on a changed input.
Multi-Topic Algorithm Problems Explained: Greedy, DP and Complexity in One Worked Example
Use one four-item 0/1 knapsack instance to separate modelling, greedy output, DP optimality, proof and pseudo-polynomial complexity.
Introduction to Dynamic Programming: State, Recurrence and a Worked Coin-Change Example
Learn how to design a DP solution from zero, then apply the method to an unlimited coin-change problem using recursion, tabulation and answer reconstruction.
Asymptotic Notations Explained: Big O, Omega and Theta with Worked Examples
Learn what upper, lower and tight bounds mean, prove a quadratic bound with constants, and trace a dependent nested loop without settling for a loose answer.
Minimum Spanning Tree Properties: Cut, Cycle, Uniqueness and a Worked Example
Build and certify an MST on one six-vertex graph, then use exchange rules to find second-best trees, handle weight changes, and understand uniqueness.
Job and Activity Selection: Greedy Rules, Worked Examples and Exam Traps
Learn why activity selection sorts by finish time while unit-time job sequencing sorts by profit. Trace both algorithms, test their invariants, and avoid the standard traps.
Huffman Coding Explained: Greedy Construction, Prefix Codes and a Worked Example
Build a Huffman tree step by step, derive exact prefix codes, verify the 224-bit weighted cost twice, and learn why the greedy merge is optimal.
Bellman-Ford Algorithm Explained: Relaxation, Negative Cycles and a Worked Example
Follow every relaxation in a complete Bellman-Ford run, reconstruct the shortest paths, then detect a reachable negative cycle after one edge changes.
Optimal Merge Pattern: Greedy Rule, Worked Example and Min-Heap Method
Learn why merge order changes total cost, then follow a complete min-heap example and proof for files of sizes 5, 10, 20, 30 and 35.
Kruskal's Algorithm and MST Explained: A Step-by-Step Worked Example
Learn what an MST is, how DSU makes Kruskal's cycle decisions, and how a seven-vertex graph reaches six selected edges with total weight 14.
Theory of NP-Completeness: Concepts, Certificate Checks and a Worked Reduction
Learn what P, NP, NP-hard and NP-complete mean. Verify a clique certificate, then follow a complete 3-SAT to CLIQUE reduction with both proof directions.
Selection Sort Explained: Step-by-Step Trace, Complexity and Exam Traps
Learn the invariant behind Selection Sort, trace every pass, derive its exact comparison count, and avoid common stability and swap-count traps.













