0% found this document useful (0 votes)
25 views3 pages

Daa Questions 2020

DAA QUESTION PAPER

Uploaded by

kanishkk070
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)
25 views3 pages

Daa Questions 2020

DAA QUESTION PAPER

Uploaded by

kanishkk070
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/ 3

Name:

Enrolment No:

END-TERM REPEAT EXAMINATION – AUGUST 2020


COURSE: CSE 2003 - DESIGN AND ANALYSIS OF ALGORITHMS

Programme: B.Tech(All Branches) Semester: II(Even: 2019-20)


Duration: 3 hrs. Max. Marks:100

Instructions:
➢ All Questions are compulsory.
➢ Use of scientific calculator is not permitted.
➢ You are allowed to use rough paper and pen during the exam.

Section A (Total 10 Marks)


Q1 Mark the correct answer (only one answer is correct). Each question carries one mark.
A If T(n) = n√n then, which of the following is not true? [1]
(a) T(n)  O(n) (b) T(n)  O(n2log n) (c) T(n)  O(n2) (d) T(n) 
O(n3)

B An algorithm has two phases. The first phase, initialization, takes time O(n2). The
second phase, which is the main computation, takes time O(n log n). What is the most
accurate description of the complexity of the overall algorithm? [1]
(a) O(n log n) (b) O(n2) (c) O(n3log n) (d) O(n2 + nlog n)

C The worst case time complexity of heap sort and Quick sort is
(a) O(nlogn) and O(nlogn) respectively
(b) O(n2) and O(nlogn) respectively [1]
(c) O(nlogn) and O(n2) respectively
(d) O(n2) and O(n2) respectively
D Which of the following statement is not true about binary heap?
(a) Each path from root to a leaf is sorted
(b) A heap is a full binary tree [1]
(c) A heap is a binary tree
(d) A heap is a complete binary tree

E In O-notation, T(n) = 2n3 + 4n2logn + 7logn + 5 is written as


(a) O(n2logn) (b) O(n2) (c) O(n3) (d) O(2n3) [1]

F Big-O notation gives _______________________ estimate measure for the asymptotic


computational complexity of algorithm. [1]
(a) exact (b) approximate (c) mathematical (d) theoretical
Big-O notation is defined for
(a) sufficiently small values of input n (b) any values of input n
G (c) sufficiently large values of input n (d) integer values input only [1]

H Which of the following statement is not applicable for Big O notation?


(a) Focus on large input sizes
(b) Ignore details of machine and programming language [1]
(c) Ignore constant terms and lower order terms
(d) Gives lower bound of algorithms

I In O-notation, log(2n) is
(a) O(log n) (b) O(log(2n)) (c) O(log2) (d) O(2log n) [1]

J Asymptotic analysis is independent of


(a) Programming language (b) CPU speed (c) Compiler (d) Operating [1]
System (e) All of these

Section B (Total 90 Marks)


Q2 a) Define NP-complete problem. Why such set of problems called ‘complete’?

b) State Cook-Levin theorem in the context of NP-completeness.

c) Verify the correctness of the following algorithm to compute power of a number, i.e.
xn, e.g. x=5, n=3, then xn = 53 = 125.
my_pow_func(x, n)
{ // where x is any real number and n is any integer [5+5+5]
p=1;
for( i = 1; i< n; i++)
p = p * x;
return p;
}

Q3 a) Give a Dynamic programming based pseudocode for the longest common


subsequence problem.
b) Using your algorithm find the length of the longest common subsequence of the [5+10]
following two string: ABCDEFG and XZACKDFWGH.

Q4
Consider the following graph.

[7.5+7.5]

(a) Compute a Minimum Spanning Tree(MST) of the graph using


(i) Kruskal's algorithm
(ii) Prim's algorithm
What is the total cost of the Minimum Spanning Tree that you formed?
Q5 a) Write Dijkstra’s shortest paths algorithm to compute shortest distances from a source [10+5]
to all other vertices in a connected, directed and weighted graph.

b) Use Dijkstras algorithm on the graph below, using vertex S as the source. Write the
vertices in the order which they are traversed and compute all distances at each step.

Q6 [10+5]
a) Give a Backtracking algorithm to solve the n queen problem.

b) Discuss any one efficient algorithm for the string-matching problem.

Q7 [15]
Use the Floyd algorithm on the weighted, directed graph in the following figure. Find
the distance matrix D(k) that results for each iteration.

You might also like