Final answer:
The correct recurrence formula for the unbound knapsack problem is: dp[i] = max(dp[i], dp[i - coin] + 1). This formula is used to solve the unbound knapsack problem, which allows for an unlimited number of each type of item in the knapsack.
Step-by-step explanation:
The correct recurrence formula for the unbound knapsack problem is:
dp[i] = max(dp[i], dp[i - coin] + 1)
Where:
- dp[i] is the maximum number of coins needed to make a sum of i
- dp[i - coin] represents the maximum number of coins needed to make a sum of i - coin
- coin is the value of the current coin being considered
This recurrence formula is used to solve the unbound knapsack problem, which is a variation of the classic knapsack problem. The unbound knapsack problem allows for an unlimited number of each type of item in the knapsack. The recurrence formula recursively calculates the maximum number of coins needed to make each possible sum, starting from 0 and going up to the desired sum.