You are on page 1of 2

UKA TARSADIA UNIVERSITY

B.Tech (CE)/B.Tech (IT) ( Semester 5 )


030090503(2017-18)/030080503(2017-18)
Design and Analysis of Algorithms
Date :24/10/2018 Time :9:30AM- 12:30PM
Max. Marks:60
Instructions :
1. Attempt all questions.
2. Write each section in a separate answer book.
3. Make suitable assumptions wherever necessary.
4. Draw diagrams/figures whenever necessary.
5. Figures to the right indicate full marks allocated to that question.
6. Follow usual meaning of notations/abbreviations.
SECTION - 1
Q 1 A) What are the advantages of binary search over sequential search? Explain binary search algorithm [6]
using recursive approach with an appropriate example.
OR
Q 1 A) Write an algorithm for merge sort and derive its average case time complexity.

Q 2 A) Answer the following in brief. (Any 3) [6]


I) Find out time complexity of following recurrence relation using substitution method:
i. T(1)= c1
ii. T(n)=2T(n-1) + c
II) Explain big-theta () notation.

III) Find the asymptotic tight bound for f(n) = 27n2 + 16n + 25. Also compute c and n .
0

IV) What is an algorithm? Enlist various properties for an algorithm.

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

Q 3 A) Answer the following in brief. (Any 1) [2]


I) What is job scheduling problem? State the time complexity of job scheduling algorithm.

II) Define: Optimal solution and feasible solution.

Q 3 B) Answer the following in detail. (Any 2) [10]


I) Solve the following instances of single-source shortest path problem with vertex S as source.
II) Apply the Kruskal’s algorithm and obtain minimum spanning tree.

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.

Q 6 Answer the following in detail. (Any 2) [12]


I) Obtain the all pair-shortest path using Floyd’s algorithm for given weighted graph.

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.

You might also like