Skip to content

Samarth2486/DP-SAM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📘 Dynamic Programming Patterns – 4 Approaches per Problem

This repository contains clean and well-organized C++ solutions to classic Dynamic Programming (DP) problems.
Each problem is implemented using the four standard approaches:

  • 🧠 Recursive
  • 🧠 Memoized (Top-Down DP)
  • 🧮 Tabulation (Bottom-Up DP)
  • 🧮 Space Optimized

💡 Why 4 Approaches?

Each approach builds foundational understanding and is useful in different scenarios:

Approach Time Complexity Space Complexity Use Case
Recursive Exponential O(1) For brute-force understanding
Memoized O(n × m) O(n × m) Efficient for top-down problems
Tabulation O(n × m) O(n × m) Good for iterative problems
Space Optimized O(n × m) O(min(n, m)) Optimal for large inputs when reconstruction isn’t needed

About

Trying to understand various approaches

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages