Professional Documents
Culture Documents
2 10
Item Profit Weight
1 3 3
2 4 2
3 5 3
4 6 5
2 Solve the Job Sequencing Problem using FIFOBB. Select
optimal subset J with an optimal penalty for the following
data. What will be the penalty corresponding to the optimal
solution? Discuss how queue is used in the state space tree
using fixed tuple representation.
4 10
School of Computer Science and Engineering
Fall Semester 2022-2022 Continuous Assessment Test – II
SLOT :G1+TG1
Programme Name & Branch : B.Tech - CSE
Course Name & code : BCSE204L – Design and Analysis of Algorithms
Class Number (s) :
Exam Duration : 90 Min. Maximum Marks: 50
2 10 CO2 BL6
Item Profit Weight
1 3 3
2 4 2
3 5 3
4 6 5
2 Solve the Job Sequencing Problem using FIFOBB. Select
optimal subset J with an optimal penalty for the following
data. What will be the penalty corresponding to the optimal
solution? Discuss how queue is used in the state space tree
using fixed tuple representation.
4 10 C03 BL6
School of Computer Science and Engineering
Fall Semester 2022-2022 Continuous Assessment Test – II
SLOT :G1+TG1
Programme Name & Branch : B.Tech - CSE
Course Name & code : BCSE204L – Design and Analysis of Algorithms
Class Number (s) :
Exam Duration : 90 Min. Maximum Marks: 50
Modul Max
Q.No Question CO BL
e Mark
1 What is the difference between FIFOBB and LIFOBB? Solve the 2 10 CO2 BL6
Knapsack Problem using LIFOBB, assume knapsack capacity is
W =8. Show how stack is used for node creation in the state
space tree using variable tuple representation.
^
Minimum Penality is C=50 , so maximum profit of 90 with jobs
{0,0,1,1,}
3 Using a string-matching algorithm which uses hashing
functions, how many spurious hits does the algorithm (with q
to be 11) encounter in the Text =ABCBBCABCBA when
looking for the pattern Pattern = CBA?
Ans
H(X) = {P[2]*102+P[1]*101+P[0]}mod 11.
Assign value A=1, B=2, C=3
H(P) = (300+200+1)mod 11 =321=2.
Text: ABCBBCABCBA
3 10 CO3 BL6
ABC = 100+20+3 = 123
BCB = ((123)mod100)*10+2=232 mod 11 = 1
CBB = ((232)mod100)*10+2=322 mod 11 = 3
BBC = ((322)mod100)*10+3=223 mod 11 = 3
BCA = ((223)mod100)*10+1=231 mod 11 = 0
CAB = ((231)mod100)*10+2=312 mod 11 = 4
ABC = ((312)mod100)*10+3=123 mod 11 = 2 – spurious hit
BCB = ((123)mod100)*10+2=232 mod 11 = 1
CBA = ((232)mod100)*10+1=321 mod 11 = 2
Total number of spurious hits is 2 for the patten CBA.
4 John is driving his electric car from Vellore and has planned to 4 10 C03 BL6
visit tourist places around Vellore. Due to limitations of
charging on the road, he needs to find the shortest path from
Vellore to all other chosen tourist places, though. The road
map with tourist places between Vellore and tourist places is
given as a weighted directed graph G = (V,E) along with
weights w (representing the distance). Find the shortest path
from source vertex A (i.e., Vellore) to all other vertices (i.e., to
all other visiting place around Vellore) using suitable
algorithm for the given graph. Write the pseudocode of your
algorithm.
Ans:
Shortest path From A to B : ACB: Cost is 3
Shortest path From A to C: AC: Cost is 6
Shortest path From A to D: AD: Cost is 2
Shortest path From A to E: ACE: Cost is 4
Shortest path From A to F: ACBF: Cost is -1
Shortest path From A to G: ADG: Cost is 8
5 In a wireless network, node S wishes to send some packets to node 4 10 C03 BL6
T, but S and T are not directly connected. We need to find the path
that can transfer the most packets from node S to node T, while
satisfying the capacity constraints of the edges. The network is
represented as a graph, G = (V,E). Design an algorithm with
complexity O(VE2), and find the maximum number of packets
transfered from node S to node T using the given graph.
Ans:
• SADT Max flow is =6
Maximum Flow = 46