Question
1. Write brute force, greedy, dynamic algorithm and branch and bound algorithm for 0/1 knapsack problem. Find an optimal solution to the knapsack instance n=7,
1. Write brute force, greedy, dynamic algorithm and branch and bound algorithm for 0/1 knapsack problem. Find an optimal solution to the knapsack instance n=7, m=15,(p1,p2,.....p7)=(10,5,15,7,6,18,3) and (w1,w2,.....w7)=(2,3,5,7,1,4,1) using each of these approaches. Explain the time and space complexity of each approaches.
2. Given a chain of 4 matrices A1, A2, A3 and A4 with dimensions 5*4, 4*6, 6*2, and 2*7, respectively. Using Dynamic programming find the minimum number of scalar multiplications needed and also write the optimal multiplication order.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started