{"id":21360214,"url":"https://github.com/rudrakshi99/dynamic_programming","last_synced_at":"2025-03-16T06:28:34.740Z","repository":{"id":134267205,"uuid":"285273347","full_name":"rudrakshi99/Dynamic_Programming","owner":"rudrakshi99","description":"A collection of dynamic programming problems implemented in C++.","archived":false,"fork":false,"pushed_at":"2020-09-17T12:46:25.000Z","size":3243,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-22T18:53:25.964Z","etag":null,"topics":["algorithms","competitive-programming","cpp","dynamic-programming"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rudrakshi99.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-05T11:52:23.000Z","updated_at":"2020-09-17T12:46:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"25264dc5-a75e-461c-bc4a-02f9a61c5962","html_url":"https://github.com/rudrakshi99/Dynamic_Programming","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rudrakshi99%2FDynamic_Programming","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rudrakshi99%2FDynamic_Programming/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rudrakshi99%2FDynamic_Programming/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rudrakshi99%2FDynamic_Programming/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rudrakshi99","download_url":"https://codeload.github.com/rudrakshi99/Dynamic_Programming/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243835951,"owners_count":20355611,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithms","competitive-programming","cpp","dynamic-programming"],"created_at":"2024-11-22T05:33:00.051Z","updated_at":"2025-03-16T06:28:34.703Z","avatar_url":"https://github.com/rudrakshi99.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dynamic Programming\n\n**“Those who cannot remember the past are condemned to repeat it ⏳⌛.”**\n\nDynamic Programing is all about remembering answers to the subproblems you’ve already solved and not solving it again.\n\n## Where do we need Dynamic Programming?\n* If you are given a problem, which can be broken down into smaller sub-problems.\n* These smaller sub-problems can still be broken into smaller ones - and if you manage to find out that there are some overlappping sub-problems.\n* Then you’ve encountered a DP problem.\n\n**The core idea of Dynamic Programming is to avoid repeated work by remembering partial results.**\n\n## Dynamic Programming and Recursion:\n\n**Dynamic programming is basically, recursion plus memoization....**\n\n* Recursion allows you to express the value of a function in terms of other values of that function.\n* If you implement your function in a way that the recursive calls are done in advance, and stored for easy access, it will make your program faster.\n* This is what we call Memoization - it is memorizing the results of some specific states, which can then be later accessed to solve other sub-problems.\n\nThe intuition behind dynamic programming is that we trade space for time, i.e. to say that instead of calculating all the states taking a lot of time but no space, we take up space to store the results of all the subproblems to save time later.\n\n## Optimization Problems\nDynamic Programming is typically applied to optimization problems. In such problems there can be many possible solutions. Each solution has a value, and we wish to find a solution with the optimal (minimum or maximum) value. We call such a solution an optimal solution to the\nproblem. If same suproblems are called again and again, that problem has **Overlapping Subprolems property**. Like other typical Dynamic Programming(DP) problems, recomputations of same subproblems can\nbe avoided by constructinng a temporary array dp[] and memoizing the computed values in this array.\n\n## Dynamic Programming Solution\n1. **Top Down DP**- In Top Down, you start building the big solution right away by explaining how you build it from smaller solutions.\n2. **Bottom Up DP**- In Bottom Up, you start with the small solutions and then use these small solutions to build up larger solutions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frudrakshi99%2Fdynamic_programming","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frudrakshi99%2Fdynamic_programming","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frudrakshi99%2Fdynamic_programming/lists"}