Maharaja Agrasen Institute of Technology, Delhi
Department of Information Technology
Assignment 2
Subject Name: Design and Analysis of Algorithm
Subject Code: CIC 311
Class: 5I123, 5I456, 5I789
Faculty:
Assignment Date Given Due Date Mode of Submission Total Marks COs
No mapped
1 22/9/2024 3/10/2024 Hardcopy 30 CO2
Questions:
Q 1. Apply activity selection algorithm and find the solution on the following activities (S)
S = {p, q, r, s, t, u, v, w, x, y, z} [5][CO2]
start and finished times for proposed activities are (1, 4), (3, 5), (0, 6), 5, 7), (3, 8), 5, 9), (6, 10),
(8, 11), (8, 12), (2, 13) and (12, 14).
Q2.Solve the following Fractional knapsack problem using dynamic programming: [7.5][CO2]
Objects : 1 2 3 4 5 6 7
Profit (P in $) : 5 10 15 7 8 9 4
Weight(w(in Kg) : 1 3 5 4 1 3 2
W (Weight of the knapsack): 15 Kg
Q. 3 Solve the following example using Task Scheduling Algortihm: [7.5][CO2]
ai 1 2 3 4 5 6 7
di 4 2 3 3 2 1 6
wi 70 60 60 40 100 20 10
Q. 4 Find Huffman code for a file containing following characters with given frequency.
[5][CO2]
Character A B C D E F
Frequency(in 11 12 13 14 24 26
thousands)
Q. 5 Solve following graph coloring problem using backtracking approach.(any one) (Solve it
using tree method) [5][CO2]
(a) (b)