Dynamic Programming Flashcards
1
Q
what is DP
A
- enhanced recursion
- recursion is parent of DP
2
Q
how to identify DP problem
A
- 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
3
Q
Questions involve in DP
A
0-1 knapsack
unbounded knapsack
fibonachi
LCS
LIS - longest increasing subsequence
kadanes algo
matrix chain multi
DP on trees
DP on grid
others
4
Q
explain 0/1 knapsack problem
A
5
Q
A
5
Q
- Explain what is subset sum problem
A
6
Q
- explain equal sum partition problem
A
-
7
Q
- explain count of subsets sum with given sum
A
- number of subsets find karyche, kiti ahe jyanchi sum given sum shi match hoti
- ## return zero, if no subsets
8
Q
- minimum subset sum difference
A
- 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
9
Q
- count the number of subset with a given difference
A
-
10
Q
- Explain what is Target Sum Problem
A
- 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
11
Q
A
12
Q
signs dilyane kay hot ahe
A
- 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
13
Q
Is Target sum problem same as count subset with given difference
A
14
Q
what are three types of knapsack
A
- fractional knapsack
- 0 1 knapsack
- unbound knapsack