Week 6 > Dynamic Programming > Knapsack Flashcards

1
Q

What is the knapsack problem definition?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q
  1. What are the knapsack problem variations?
  2. In which knapsack problem variation greedy algorithm does not work?
A

2. Gree does not work for discrete knapsack! will design a dynamic programming solution.

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

Can you provide the solution of 1. w/o repeats; 2. with repeats?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q
A
  • Greedy Solution: $30 -> 6 kg and $14 -> 3 kgs
  • Optimal Solution: $30 -> 6 kg and $16 -> 4 kgs
  • Since the total value of greedy solution = $44 while the optimal solution is $46
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