King Khalid University College of Science and Arts in Tanumah Department of Computer Science Design and Analysis of Algorithms Assignment 4
King Khalid University College of Science and Arts in Tanumah Department of Computer Science Design and Analysis of Algorithms Assignment 4
Question 1:
Activit 1 2 3 4 5 6 7 8 9 10
y
Start 1 1 2 4 5 8 9 11 12 13
Finish 3 8 5 7 9 10 11 14 17 16
Question 2:
Consider the 5’ jobs are given with their profits and deadlines as the
following {p ,p ,..,p }= {20,15,10,5,1}, {d , d , .., d } = {2,2,1,3,3}.
1 2 5 1 2 5
Sort all the items in decreasing order of their value / weight ratio-
I1 I3 I2 I4
10 9 7 3
Knapsack Items in
Cost
Weight Knapsack
16 0
6 I1 100
3 I1,I4 112
Had the problem been a 0/1 knapsack problem, knapsack would contain the
following items:-
< I1 , I4 >