Professional Documents
Culture Documents
III) Find the asymptotic tight bound for f(n) = 27n2 + 16n + 25. Also compute c and n .
0
Q 2 B) Write an algorithm to find Fibonacci series with iterative and recursive approach. [6]
OR
Q 2 B) Solve following recurrence relation using recursion tree method:
T(n) = 4T(n/2) + n
III) Consider that there are three items. Thier weights and profit values of each item are given below.
Calculate maximum profit using fractional knapsack with tracing.
items Wi Pi
1 18 30
2 15 21
3 10 18
SECTION - 2
Q 4 A) Answer the following in brief (Any 1) [2]
I) Differentiate deterministic and non-deterministic algorithms.
II) Discuss P class problem with an example.
Q 4 B) Answer the following (Any 1) [4]
I) Apply Rabin-Karp algorithm on text T=23590673993141526 and pattern P=67399 with modulo q=13.
II) Define finite automata. Construct the string matching automaton for the pattern P=aaba and illustrate its
operation on the text string T=abaababbaaba.
Q 5 A) Answer the following in brief. (Any 1) [2]
I) (a) Write an example of inorder traversal.
(b) Define: dense graph
II) Explain adjacency-matrix representation of graph.
Q 5 B) Answer the following in detail. (Any 2) [10]
I) Explain depth first search algorithm with an example. Write down time complexity for DFS algorithm.
II) Solve following instances for Knapsack problem using branch and bound method with n=4 units.
v(40,42,25,12), w=(4,7,5,3) and capacity=110.
III) Explain topological sorting with an example.
II) Solve the following 0/1 knapsack problem using dynamic programming. There are five items whose
weights and values are given in following arrays where W=5.
Weight w[ ] = {2,1,3,2}
Value v[ ] = {12,10,20,15}
III) Differentiate greedy approach and dynamic approach. Write an algorithm for making change problem
using dynamic programming.