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.

Updated 27 Nov 20265 min readDSA & Algorithms

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.

Updated 26 Nov 20266 min readDSA & Algorithms

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.

Updated 25 Nov 20266 min readDSA & Algorithms

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.

Updated 24 Nov 20266 min readDSA & Algorithms

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.

Updated 23 Nov 20266 min readDSA & Algorithms

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.

Updated 23 Nov 20266 min readDSA & Algorithms

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.

Updated 22 Nov 20266 min readDSA & Algorithms

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.

Updated 21 Nov 20266 min readDSA & Algorithms

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.

Updated 20 Nov 20265 min readDSA & Algorithms

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.

Updated 19 Nov 20265 min readDSA & Algorithms

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.

Updated 19 Nov 20265 min readDSA & Algorithms

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.

Updated 18 Nov 20265 min readDSA & Algorithms