Dynamic Programming Flashcards

1
Q

what is DP

A
  • enhanced recursion
  • recursion is parent of DP
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

explain 0/1 knapsack problem

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
  1. Explain what is subset sum problem
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
  1. explain equal sum partition problem
A

-

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
  1. 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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
  1. 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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
  1. count the number of subset with a given difference
A

-

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
  1. 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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Is Target sum problem same as count subset with given difference

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

what are three types of knapsack

A
  1. fractional knapsack
  2. 0 1 knapsack
  3. unbound knapsack
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

what is difference between this three types of knapsack

A

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

16
Q

which problems are variations of unbound knapsack

A
  1. 4.
17
Q

code of 01 knapsack

A

if( wt[ i-1 ] <= j )
max( val[ i - 1 ] + t[ i - 1 ] )

18
Q

code of unbound knapsack problem

A
19
Q

14 explain rod cutting problem

A

ek rod dileli aste, tyachi ek length dileli aste

20
Q
  1. Explain problem statement of Coin change problem: max number of ways
A
21
Q

16 Coin change problem: Minimum number of coins

A
22
Q

17 Coin change problem Contd.

A
23
Q

18 Longest common subsequence Introduction

List variations of LCS

A

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

24
Q
A
24
Q
A
25
Q
A
25
Q
A