Assignment 2

Instructions to Solve Assignments

The purpose of the assignments is to give students hands on practice. It is expected that students will solve assignments themselves. The Following rules that will apply during the evaluation of the assignment.

Cheating from any source will result in zero marks in the assignment.

Any student found cheating in any two of the assignments submitted during the course will

be awarded “F” grade in the course.

No assignment after the due date will be accepted.

Fall 2019

Answer the following questions in your own words. Plagiarism will be checked for each question. Marks will be awarded on the basis of the answer and plagiarism report.

Question 1

Prove that 2.n3 + 3.n + 10 O(n4)

Question 2

Use Brute Force Method to find an optimal solution for the 0-1 Knapsack problem.

(10 Marks) (20 Marks)

(20 Marks)

item weight value

1 4 40

2 10 60

3 20 100

4 10 20

Question 3

knapsack capacity W = 32

For the sequence of matrices, given below, compute the order of the product, A1.A2.A3.A4.A5, in such a way that minimizes the total number of scalar multiplications, using Dynamic Programming.

Order of A1 = Order of A2 = Order of A3 = Order of A4 = Order of A5 =

10x25 25x5 5x30 30x20 20x10

Fall 2019

**Q. 2 Solution:**

**Q. 3 Solution:**