Dynamic Programming Flashcards
what is DP
- enhanced recursion
- recursion is parent of DP
how to identify DP problem
- recursion ke identify karne ke jo tarike he wahi tarike DP ko identify karne ke liye bhi use honge
- DP me optimal solution chaiye hota he
- ## agar hamare pas choice hoga, to wo DP ka problem hoga
Questions involve in DP
0-1 knapsack
unbounded knapsack
fibonachi
LCS
LIS - longest increasing subsequence
kadanes algo
matrix chain multi
DP on trees
DP on grid
others
explain 0/1 knapsack problem
- Explain what is subset sum problem
- explain equal sum partition problem
-
- explain count of subsets sum with given sum
- number of subsets find karyche, kiti ahe jyanchi sum given sum shi match hoti
- ## return zero, if no subsets
- minimum subset sum difference
- ek array dilela ahe
tyala two arrays made partition karyche - suppose P1 and P2
- donhi partition chi sum kadychi, sum1 and sum2
- ani sum1 - sum2 minimum aala pahije
- ## larger number madun chota sum minus karycha
- count the number of subset with a given difference
-
- Explain what is Target Sum Problem
- ek sum dilel asel
- pratek array element samor sign dyachi, + kiva
- ani signs ashya prakere assign kryche ahe ki, ji sum dileli ahe, ti sum aali pahije
- ## pratek element samor sign den compulsary ahe
signs dilyane kay hot ahe
- signs dilya ne, to given array don subsets mde divide houn zato
- ek positive int cha array
- ek negative int cha array
- ## ani aapan tya don sub arrays la minus kartoy
Is Target sum problem same as count subset with given difference
what are three types of knapsack
- fractional knapsack
- 0 1 knapsack
- unbound knapsack
what is difference between this three types of knapsack
0 1 - knapsack
- elements la completely include karu shakto kiva include nahi karu shakat
01 knapsack made aapan ekada decide karto ki particular item la include karycha ahe ki nahi, nantr aapan tyala sodun deto
unbound knapsack
unbound knapsack mde aapan eka element la analyse kel ki yala select kryache ka nahi mag aapan parat tya element la visit karun select kiva non-select karu shakto
unbound knapsack allows multiple occurences of same item
which problems are variations of unbound knapsack
- 4.
code of 01 knapsack
if( wt[ i-1 ] <= j )
max( val[ i - 1 ] + t[ i - 1 ] )
code of unbound knapsack problem
14 explain rod cutting problem
ek rod dileli aste, tyachi ek length dileli aste
- Explain problem statement of Coin change problem: max number of ways
16 Coin change problem: Minimum number of coins
17 Coin change problem Contd.
18 Longest common subsequence Introduction
List variations of LCS
longest common substring
print LC substring
shortest common substring
print SCS
minimum no of insertion and deletions
largest repeating subsequence
length of longest subsequence of a which is a substring is b