Coder Social home page Coder Social logo

dynamic_programming's Introduction

Dynamic_Programming

What Is Dynamic Programming

Dynamic Programming is basically an optimization over recursion. Recursion leads us to recalculations of some of the subproblems again and again , thus to reduce the overhead time complexity , we may save the results of the subproblems into some table so that we may not need to recalculate them and we can easily fetch those results whenever required in the future.

How to recognise a dynamic programming problem ?

Generally all the problems that require to optimize (i.e. maximize or minimize) certain quantity or counting problems(count the number of ways) can be solved by using Dynamic Programming. Also, all dynamic programming problems satisfy the overlapping subproblems property and most of the classic dynamic problems also satisfy the optimal substructure property.

Once, we observe these properties in a given problem, be sure that it can be solved using DP.

How to approach a DP problem

We can approach a dynamic Programming problem in two ways:

  1. Bottom Up (a.k.a. Tabulation Method) Tabulation is the method that avoids recursion. In this approach, we solve the sub-problems first. This is typically done by filling up an n-dimensional table. Based on the results in the table, the solution to the original problem is then computed.

  2. Top Down (a.k.a Memoization Method) In this approach, we try to solve the bigger problem by recursively finding the solution to smaller sub-problems. Whenever we solve a sub-problem, we cache its result so that we don’t need to solve that again in future (if required). Instead, we can just return the saved result. This technique of storing the results of already solved subproblems is called Memoization.

Hereby including some of the standard problems of dynamic programming.

dynamic_programming's People

Contributors

kratimitra avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.