0% found this document useful (0 votes)
21 views2 pages

Daa Questions 2017

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)
21 views2 pages

Daa Questions 2017

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/ 2

Name:

Enrolment No:
Date:

END-TERM EXAMINATION – JUNE 2017


Course: CSE2003 Design and Analysis of Algorithms
[[[

Programme: B. Tech CSE / CSC Semester: IV, 2016-2017


Duration: 3 Hrs Max. Marks: 60
Weightage: 40%
Instructions:
 All Questions are compulsory.
 Start each answer on a fresh page and number your answers clearly. Answer all parts of the same
Question together and in sequence.
 Calculator is not required.

SECTION – A (Total 20 Marks)


Q1 Answer the following questions:

In N-Queen problem, N number of queens are placed on a NxN chess board such that
i) no two queens attack each other (i.e. no two queens are placed in the same row or same 5 marks
column or the same diagonal). Find a solution for N-Queen problem using
backtracking for N=4. Show a solution path of the board configurations in the form of
a partial state space tree; explicitly mark the nodes where backtracking occurs. Show
the exact configuration of at least one of the solutions.

ii) Check the applicability of masters Theorem for finding the time complexity of
following recurrence relation
𝑛 5 marks
𝑇(𝑛) = 64𝑇 ( ) − 𝑛2 𝑙𝑜𝑔𝑛
8

iii) A networking company uses compression technique to encode the message before
transmitting over the network. Suppose the message contains the following characters.
Frequencies of the characters are also specified in the table below.
Character Frequency
A 5 5 marks
B 9
C 12
D 13
E 16
F 45
By assuming that Huffman coding is used as compression technique coding, construct
the Huffman tree and find out the codes for all the characters. Also calculate the
percentage of saving.

iv) Write the KMP algorithm for string matching and illustrate with a suitable example. 5 marks
SECTION – B (Total 40 Marks)

i) Briefly write the steps involved in the Dijkstra’s algorithm.


Q2.
ii) Run Dijkstra's algorithm on the graph given below. Let the source node be
a. By assuming source node as a run Dijkstra’s algorithm on following
4+6
graph.
= 10
4
b c marks

2 5 6
3

7 4
a d e

i) Write a generalize recursive expression for the minimum number of scalar


Q3. multiplications needed to optimally parenthesize a series of matrices Ai to Aj 4 + 6 =
(represented as Ai, j) to be multiplied.
10 marks
ii) Given four matrices as A5x4 , B4x6 , C6x2 , D2x7. Find the optimal parenthesized order
along with total number of scalar multiplications needed to multiply the following
sequence of matrices ABCD. You can use a tree to show the results or tabulate the
results of the sub-problems in a two dimensional matrix.

Apply greedy Knapsack technique to solve the following problem. Number of items is
Q4. 7 and the knapsack capacity is 15.

Given that the profits (i.e. values or costs) are as follows:


(P1, P2, P3, P4, P5, P6, P7) = (10, 5, 15, 7, 6, 18, 3) 10 marks
Weights: (W1, W2, W3, W4, W5, W6, W7) = (2, 3, 5, 7, 1, 4, 1)

Show the results for each of the following greedy strategies: -


i) Greedy about weights
ii) Greedy about profit (i.e. value or cost)
iii) Greedy about profit per unit weight.

Q5. i) Write a short note on non-deterministic algorithm.


4+6=
ii) Using the concept of problem reduction, prove that vertex cover problem is
NP-complete. 10 marks

You might also like