Giter Club home page Giter Club logo

dp-cheatsheet's Introduction

DP-CheatSheet

DP Classifications:

  • KnapSack Problem
  • LIS
  • LCS
  • Matrix Chain Multiplication
  • DP on Grid
  • Kadane's Algorithm
  • Advanced DP:
    • DP Kth Lexicogrophical String
    • DP on Tree
    • DP + Bitmasking
    • DP + Segment Tree
    • DP + Convex Hull
    • DP + Pre Processing
    • DP + Trie
    • DP + Geometry
    • DP + Binary Search
    • DP + Knuth Optimization

Knapsack Problem

  • Knapsack means a bag.

  • Items with Price and Weight are given.

  • We have to fill the bag to get maximum profit.

  • Example:
    -Given List of Weights: 3,2,4
    -Given List of profits: 8,5,9
    -Weight to be filled: 7
    -Best possible combination with maximum profit: 4+3=7=Weight with Profit 9+8=17.

  • Types of Knapsack:
    - 0/1: Can't include an item multiple times.
    - Bounded: Can include an item multiple times but with a limit.
    - Unbounded: Can include an item multiple times with no limit.

  • Types of Knapsack:
    - Fractional: Can include a part of an item.
    - Integer: Can't include a part of an item.

  • Some Knapsack problems variations:
    - Subset sum problem
    - Partition equals subset problem
    - Count of Subsets with particular sum.
    - Partition of Set into 2 subsets such that difference of both the subsets should be minimum.
    - Target Sum.

Matrix Chain Multiplication

  • Given a List of Matrices.
  • Find the most efficient way to multiply the matrices together.
  • Find the efficient way such that we have minimum no of multiplications.
  • Various types of problems including strings,arrays etc.

dp-cheatsheet's People

Contributors

himanshuranjan30 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.