Algorithms Modeexam Qp-Nba
Algorithms Modeexam Qp-Nba
BT
Q.NO. QUESTION M CO
LEVEL
A
R
K
S
PART - A
1 Give the Euclid algorithm for computing gcd(m, n). 2 CO1 BT1
2 Write the recursive Fibonacci algorithm and its recurrence relation. 2 CO1 BT2
3 Define the single source shortest paths problems 2 CO2 BT1
4 What is maximum cardinality matching? 2 CO2 BT2
5 Define multistage graphs. Give an example 2 CO3 BT1
6 Devise an algorithm to make for 1655 using the greedy strategy. the coins 2 CO3 BT3
available are {1000,500,100,50,20,10,5}
7 What are the factors that influence the efficiency of the backtracking 2 CO4 BT1
algorithm?
8 Give a template for a generic backtracking algorithm. 2 CO4 BT2
9 Define P and NP problems 2 CO5 BT2
10 What do you mean by primality testing? 2 CO5 BT2
PART- B
11.a) (i)Prove that if g(n) is Ω(f(n)) then f(n) is O(g(n)). (5) 5 CO1 BT5
(ii) Discuss various methods used for mathematical analysis of recursive 8 CO1 BT1
11.a) algorithms.
OR
(i)Find the time complexity and space complexity of the following problems.
Factorial using recursion and Compute nth Fibonacci number using Iterative 6 CO1 BT3
11.b) statements.
11.b) (ii) Solve the following recurrence relations:
1)T(n) = { 2 2T ( n 2 ) + 3n > 2 n = 2 7 CO1 BT3
2)T(n) = { 2T ( n 2 ) + cn n > 1 a n = 1 Where a and c are constants.
i)Write an algorithm for all pairs shortest path algorithm and what are the time
12. a) and space complexity of the algorithm 5 CO2 BT2
12. a) ii)Explain Floyd algorithm with example. Write down and explain the
algorithm to solve all pairs shortest paths problem
8 CO2 BT3
OR
i)Explain Dijkstra’s algorithm using the following graph. Find the
12.b) shortest path between v1, v2, v3, v4, v5, v6 & v7 6 CO2 BT3
V1 V2
4 1 3 10
V3 2 V4 7 V5
5 8 4 6
V6 V7
12.b) ii)Determine the max-flow in the following network.
7 CO2 BT6
13.a) i)Define divide and conquer to apply the technique in binary search algorithm BT1
and to analysis it 8 CO3
13.a) ii)Distinguish between Quick sort and Merge sort, and arrange the following 5 CO3 BT2
numbers in increasing order using merge sort. (18, 29, 68, 32, 43, 37, 87, 24, 47,
50)
OR
i)Write the Huffman’s Algorithm. Construct the Huffman’s tree for the
13.b) following data and obtain its Huffman’s Code.
Characters A B C D E -
1 CO3
_ 3 BT3
Probability 0.5 0.35 0.5 0.1 0.4 0.2