Gujarat Technological University
Gujarat Technological University
Gujarat Technological University
/Seat No_____________
Q.1 (a) Define the following terms: algorithm, set, function, relation, vector, matrix, 07
linear inequality.
(b) 1. State the general characteristics of the greedy method. 07
2. State the general characteristic of the dynamic programming method.
Q.2 (a) Apply asymptotic notations to sequential search and binary search techniques and 07
find their time complexities in best case, average case and worst case.
(b) Solve the following recurrence relations. 07
1. T(n) = 2T(n/2) + n
2. T(n) = T(n-1) + n
OR
(b) Prove that Hamiltonian problem is NP-Complete problem. 07
Q.3 (a) Solve sorting problem using divide and conquer strategy and show its working 07
applying steps on the array [27, 45, 90, 12, 5, 60].
(b) Solve following knapsack problem using greedy method. Knapsack capacity = 07
60 kg.
Item Weight Value
A 5 30
B 22 77
C 10 40
D 15 45
OR
Q.3 (a) 1. Illustrate the operation of BUILD-MAX-HEAP on the array A = (5, 3, 17, 10, 07
84, 19, 6, 22, 9).
2. Illustrate the operation of HEAPSORT on the array A = (5, 13, 2, 25, 7, 17,
20, 8, 4).
(b) Explain how assembly line scheduling problem can be solved using dynamic 07
programming method.
Q.4 (a) Solve the following instance of making change problem using dynamic 07
programming method.
N=Rs. 8, Coins: Rs. 1, Rs. 4, Rs. 6
(b) Write depth first search algorithm and show its execution on a sample graph. 07
OR
Q.4 (a) Solve the following instance of making change problem using greedy method. 07
N=Rs. 8, Coins: Rs. 1, Rs. 4, Rs. 6
(b) Write breadth first search algorithm and show its execution on a sample graph. 07
Q.5 (a) Apply and illustrate how 8-Queen problem can be solved using backtracking 07
method.
1
(b) Write Naïve string matching algorithm. Apply it to the pattern P = 0001 and the 07
text T = 000010001010001. Compute the number of comparisons required to find
pattern P in the text T.
OR
Q.5 (a) Find all the connected components from the following graph. 07
(b) Define NP-Complete problem. Define class P and class NP. List the problems 07
that fall under classes P, NP and NPC.
*************