Professional Documents
Culture Documents
:
Name :
PART - A ( 30 Marks)
1 (a) i. Euler Tour problem, 𝑇 ∈ 𝑃-class of problems, whereas Hamiltonian cycle 10
problem, 𝐻 ∈ 𝑁𝑃-class of problems. Discuss how this scenario is possible?
ii. How could anyone reach to the conclusion that: “If one NP-complete problem
can be solved in polynomial time then all problems in NP can be solved in
polynomial time.”
OR
(b) Consider a scenario of multiplying a chain of 10
6 matrices - 𝑨𝟏 𝒕𝒐 𝑨𝟔 . The value of 𝒌 – which
gives the optimal parenthesization cost is
given in the table 𝒔[𝟏 … 𝟔], [𝟏 … 𝟔] on the left.
Construct the optimal solution to multiply
matrix chain 𝑨𝟏 𝒕𝒐 𝑨𝟔 using the optimal-
parenthesis algorithm.
2 (a) Given a Text String, 𝑻 as: 𝒂𝒃𝒂𝒃𝒄𝒂𝒃𝒂𝒂𝒃 and Pattern, 𝑷 as: 𝒄𝒂𝒃𝒂𝒂𝒃. Execute the 10
KMP string matching algorithm to find whether 𝑷 occurs in 𝑻?
OR
(b) Given a Text String, 𝑻 as: 𝟏𝟐𝟖𝟕𝟗𝟎𝟒𝟓𝟑𝟕𝟖𝟐 and Pattern, 𝑷 as: 𝟑𝟕, and the value of 10
𝒒 = 𝟏𝟏. Execute the Rabin-Karp string matching algorithm to find whether 𝑷 occurs
in 𝑻. Furthermore, find the total number of spurious hits that occur while matching the
pattern.
Page 1 of 2
3 (a) i. Why are the approximation algorithms are referred to as “Quick and Dirty?” 10
ii. Why are the geometric algorithms difficult to design and implement as
compared to the traditional algorithmic solutions?
OR
(b) Find the Convex Hull for the following set of points using: 10
i. Gift wrapping algorithm.
ii. Graham’s scan algorithm.
Page 2 of 2