B.tech CSE+All - III-Design and Analysis of Algorithms

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Name:

Enrolment No:

UNIVERSITY OF PETROLEUM AND ENERGY STUDIES


End Semester Examination, December 2019
Course: Design and Analysis of Algorithms Semester: III
Program: B.Tech(CSE+All) Time 03 hrs.
Course Code: CSEG 2003 Max. Marks: 100

Instructions:
SECTION A
S. No. Marks CO
Q1 Is it true that 2n+1 ≤ O(2n)? Give a brief justification 4 CO1
Q2 Suppose you are given the array A = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], and you
then perform the binary search algorithm find the number 8. Which numbers in the 4 CO2
array A are compared against the number 8?
Q3 Explain in brief the basic asymptotic efficiency classes. 4 CO1
Q4 Discuss the effect of data structure on the time complexity of Prim’s Algorithm. 4 CO4
Q5 Briefly explain the concepts of P, NP and NP complete problems. 4 CO5
SECTION B

Q6 Devise a divide-and-conquer algorithm for finding the position of the largest element
10 CO4
in an array of n numbers.
Q7 Let A[0..n − 1] be an array of n sortable elements. (For simplicity, you may assume
that all the elements are distinct.) A pair (A[i], A[j ]) is called an inversion if i < j
and A[i]>A[j ].
a) Determine, What arrays of size n have the largest number of inversions and 4+6 CO3
what is this number?
b) Demonstrate that the average-case number of key comparisons in insertion
sort is 𝑂(𝑛 )
Q8 Construct a Huffman code for the following data:
Symbol A B C D --
Frequency 0.4 0.2 0.1 0.15 0.15

a) Encode ABACABAD using the code of question


b) Decode 100010111001010 using the code of question
7+3 CO3
OR

Solve the following instances of the single-source shortest-paths problem with vertex
a as the source:
Q9 Consider the following graph

10 CO4

The number next to the edges denotes length of the edges. Determine shortest path
between every pair of nodes.

SECTION-C

Q 10 Explain Matrix chain multiplication problem Figure out an optimal parenthesization of


5+15 CO3
a matrix-chain product whose sequence of dimensions is <30,35,15,5,10,20,25>.
Q 11 Apply the branch-and-bound algorithm to solve the traveling salesman problem for
the following graph.

20 CO5

OR
Solve the following Knapsack problem using branch and bound problem. Where
Knapsack capacity W=16
Item Weight Value
1 10 100
2 7 63
3 8 56
4 4 12

You might also like