Professional Documents
Culture Documents
CSL310 Midterm Winter 2021
CSL310 Midterm Winter 2021
CSL310 Midterm Winter 2021
Winter 2021
Maximum Marks: 25
Time: 1 hour
Slot B
1. Let us consider an instance of 0/1 Knapsack problem that we have taken in the
class. The capacity of the knapsack is W = 25 and the items are as shown in the
following table. Solve it using dynamic programming. Give its time complexity.
Trace the exact items that will be taken in the knapsack. (10)
Item A B C D
Profit 24 18 18 10
Weight 24 10 10 7
3. What is the lower bound on comparison-based sorting algorithms and why? Are
there better algorithms for sorting which are not comparison based? What is
stable sorting algorithm? Give an example of the same. (3)