0% found this document useful (0 votes)
9 views

CS402

Uploaded by

sudipkg73
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

CS402

Uploaded by

sudipkg73
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

NARULA INSTITUTE OF TECHNOLOGY

An Autonomous Institute under MAKAUT

B.TECH./CSE/EVEN/SEM-IV/R18/ CS402/2021-2022
YEAR: 2022

DESIGN AND ANALYSIS OF


ALGORITHMS
CS402
TIME ALLOTTED: 3 HOURS FULL MARKS: 70
The figures in the margin indicate full marks.
Candidates are required to give their answers in their own words as far as practicable
GROUP – A
(Multiple Choice Type Questions)
1. Answer any ten from the following, choosing the correct alternative of each question: 10×1=10
SL Question Marks Co Blooms
Taxonomy
Level
(i) If f1(n) Є O(g1(n)) and f2(n) Є O(g2(n)) then f1(n) + f2(n) 1 2 3
is:
a) O(min(g1(n),g2(n)))
b)O(max(g1(n),g2(n)))
c) O(g1(n)+g2(n))

d) O(g1(n)*g2(n))

(ii) Which one of the following problem is solved using 1 3 1


dynamic programming approach,
a) All pairs shortest path
b) Quick Sort
c) Minimum weight spanning tree
d)Connected components

(iii) The time complexity for recurrence relation 1 4 4


T(n)= T(n-1) + c is:
a)O(n)
b)O(n2)
c)O(nlogn)
d)O(2^n)

(iv) The time complexity of the merge sort, quick sort 1 1 3


algorithms in the worst case is :
a) O(n2), O(n log n)
b) O(n2), O(n2)
c) O(n log n), O(n2)
d) O (n log n), O(n log n)

(v) The complexity of matrix multiplication algorithm is 1 3 3


a) O(n3)
Page 1 of 4
Even semester theory examination 2022 under autonomy, 25-Jun-22
NARULA INSTITUTE OF TECHNOLOGY
An Autonomous Institute under MAKAUT

b) O(log n)
c) O(n 4)
d) O(n log n)

(vi) Merge sort problem is an example of 1 4 2


a) Dynamic Programming
b) Greedy Method
c) Divide and Conquer
d) Backtracking

(vii) For algorithm using backtracking, use of stack 1 3 5


a) is unavoidable,
b) can be avoided but helpful,
c) not at al necessary,
d) should be avoided

(viii) Which of the following is example of recursion? 1 1 2


a) Fibonacci
b) Tower of Hanoi
c) Factorial
d) all of the above

(ix) The complexity of searching an element from a set of n 1 1 3


elements using Binary search algorithm is
a) O(n)
b) O(log n)
c) O(n^2)
d)O(n log n)

(x) Traveling Salesman problem is 1 5 4


a) in P class
b) in NP class
c) NP Complete
d) NP Hard

(xi) BFS of a graph G=(V, E) has running time 1 4 5


a) O(|V|log|E|)
b) O(|V|)
c) O(|E|)
d) O(|V|+|E|)

(xii) Kruskal's algorithm uses........and Prim's algorithms 1 2 1


uses.......in determining MST
a) edges, edges
b) edges, vertices
c) vertices , edges,
d) vertices, vertices

Page 2 of 4
Even semester theory examination 2022 under autonomy, 25-Jun-22
NARULA INSTITUTE OF TECHNOLOGY
An Autonomous Institute under MAKAUT

GROUP – B
(Short Answer Type Questions)
(Answer any three of the following) 3 x 5 = 15

SL Question Marks Co Blooms


Taxonomy
Level
2. (i) How do you design better algorithms ? 3 3 4

(ii) What do you mean by time complexity of algorithms? 1 1 1

(iii) What is space complexity? 1 1 1

3. (i) What do you mean by recurrence realation? 1 2


(ii) Derive the worst case complexity of quick sort using 3 2 3
recursion tree.
(iii) What is in-place sorting? 1 1 1

4. (i) What is the divide and conquer method ? 2 2 2

(ii) What is the basic difference between divide 3 3 3


& conquer method and dynamic programming.

5. (i) Define different asymptotic notations 2 4 2

(ii) Find out time complexity for the recurrence T(n)=2T(n- 3 3 5


1)+c.
6. (i) What is heap property? 1 1 2
(ii) Construct a max-heap using the max-heapify algorithm 4 5 4
with the following data. <14,16,11,10,3,7,2,9,4,8,1>

GROUP – C
(Long Answer Type Questions)
(Answer any three of the following) 3 x 15 = 45
SL Question Marks Co Blooms
Taxonomy
Level
7. (i) State the general Knapsack problem. Write greedy 4 2 2
algorithm and find the complexity of this algorithm.

(ii) Find the optimal greedy solution to the Knapsack 6 4 4


problem instance n=7, m=15. Where the profits and the
weights are as follows: (p1, p2, p3, p4, p5, p6, p7)=(10, 5,
15, 7, 6, 18, 3) and (w1, w2, w3, w4, w5, w6, w7)=(2, 3, 5,
7, 1, 4, 1).
(iii) Given the character set S=<A,B,C,D,E,F> with the 5 4 4
following probability P=<29,25,20,12,05,09> of
Huffman coding problem, generate the prefix code and
corresponding binary tree using greedy approach.

Page 3 of 4
Even semester theory examination 2022 under autonomy, 25-Jun-22
NARULA INSTITUTE OF TECHNOLOGY
An Autonomous Institute under MAKAUT

8. (i) Define Spanning Tree and Minimum Spanning Tree. 4 1 1

(ii) Explain Prim’s Algorithm and derive the complexity of 5 2 3


the algorithm.

(iii) Find the Minimal Spanning Tree of a connected, 6 3 3


undirected graph as given in Fig.2 using Kruskal’s

Algorithm .
9. (i) Write the algorithm of quick sort and find the best case, 5 3 4
worst case and average case time complexity of this
algorithm.

(ii) What do you mean by dynamic programming? Write the 5 4 5


algorithm of matrix-chain multiplication

(iii) Find the optimal parenthesize of matrix-chain product 5 5 3


whose sequence of dimensions is <5,10,3,12,5,50,6>

10. (i) What is non-deterministic algorithm? Differentiate 5 3 4


between deterministic and non-deterministic algorithm.
(ii) Write an algorithm to sort an array using deterministic 5 4 2
and non-deterministic technique. Compare their
complexity.
(iii) Describe Class-P, Class-NP, NP-Hard and NP-Complete 5 2
with relation.
11. Write short notes on (Any three) 5
(i) Bellman Ford Algorithm 5 5 3
(ii) Shortest path algorithm 5 3 3
(iii) BFS and DFS 5 3 3
(iv) 8-Queens Problems 5 4 3

(v) KMP-String matching 5 4 4

Page 4 of 4
Even semester theory examination 2022 under autonomy, 25-Jun-22

You might also like