Time: 3 Hours Total Marks: 70
Time: 3 Hours Total Marks: 70
B TECH
(SEM V) THEORY EXAMINATION 2018-19
DESIGN & ANALYSIS OF ALGORITHMS
Time: 3 Hours Total Marks: 70
Note: 1. Attempt all Sections. If require any missing data; then choose suitably.
2. Any special paper specific instruction.
SECTION A
b. Define BNP, NP hard and NP Complete Problems. Prove that Travelling Salesman
Problem is NP-Complete.
c. Consider the weights and values of items listed below. Note that there is only one unit of
each item. The task is to pick a subset of these items such that their total weight is no
more than 11 Kgs and their total value is maximized. Moreover, no item may be split. The
total value of items picked by an optimal algorithm is denoted by Vopt. A greedy
algorithm sorts the items by their value-to-weight ratios in descending order and packs
them greedily, starting from the first item in the ordered list. The total value of items
picked by the greedy algorithm is denoted by Vgreedy. Find the value of Vopt − Vgreedy
Item I1 I2 I3 I4
W 10 7 4 2
V 60 28 20 24
d. Insert the following keys in a 2-3-4 B Tree:
40, 35, 22, 90, 12, 45, 58, 78, 67, 60 and then delete key 35 and 22 one after other.
e. Prove that if the weights on the edge of the connected undirected graph are distinct then
there is a unique Minimum Spanning Tree. Give an example in this regard. Also discuss
Prim’s Minimum Spanning Tree Algorithm in detail.
SECTION C
3. Attempt any one part of the following: 7x1=7
(a) The recurrence T (n) = 7T (n/3) + n2 describes the running time of an algorithm A.
Another competing algorithm B has a running time of S (n) = a S (n/ 9) + n2. What is the
smallest value of ‘a’ such that A is asymptotically faster than B.?
(b) How will you sort following array A of elements using heap sort:
A = (23, 9, 18, 45, 5, 9, 1, 17, 6).
(b) Insert the elements 8, 20, 11, 14, 9, 4, 12 in a Red-Black Tree and delete 12, 4, 9, 14
respectively.
(b) Given an integer x and a positive number n, use divide & conquer approach to write a
function that computes xnwith time complexity O (logn).
(d) What is Red-Black tree? Write an algorithm to insert a node in an empty red-black tree
explain with suitable example.
(e) Explain HEAP-SORT on the array. Illustrate the operation of HEAP-SORT on the array
A= {6, 14, 3, 25, 2, 10, 20, 7, 6}
SECTION C
3. Attempt any one part of the following: (10 x 1=10)
(a) Explain Convex –Hull problem.
(b) Find the shortest path in the below graph from the source vertex 1 to all other vertices
by using Dijkstra’s algorithm.
www.aktuonline.com
www.aktuonline.com
(a) What is backtracking? Discuss sum of subset problem with the help of an
example.
(b) Write down an algorithm to compute Longest Common Subsequence
(LCS) of two given strings and analyze its time complexity.
(a) The recurrence T (n) =7T (n/2) +n 2 describe the running time of an algorithm A.A
competing algorithm A has a running time of T’ (n) =aT’ (n/4) +n 2 .What is the largest
integer value for a A’ is asymptotically faster than A?
www.aktuonline.com
(b) Discuss the problem classes P, NP and NP –complete .with class relationship.
(b) Given the six items in the table below and a Knapsack with Weight 100, what is the
solution to the Knapsack problem in all concepts. I.e. explain greedy all approaches and find
the optimal solution
www.aktuonline.com
ltr TL
I
www.aktuonline.com
Roll No.
B.TECH.
Section - A
algorithm.
d) Define Binaryheap.
s0tnu20r5n3260 (1)
lP.T.O.
www.aktuonline.com
7 f, www.aktuonline.com
NCS-501
s) Write the names of various design techniques of
algorithrn.
j) DefineP,NPandNPcompleteindecisionproblem.
Section - B
50lll1l20l6lt3260 (2\
www.aktuonline.com
F' ryT ,
www.aktuonline.com
'f
ST,E
I
l
NCS.sO1
Section-C
Note: Attempt any 2questions from this section.
(2x15:30)
10. i) State Bellman ford algorithm.
tr@@Etr
www.aktuonline.com
501,t11t2016n3260 (3)
www.aktuonline.com
www.aktuonline.com
B. Tech.
Section-A
Note : Ali cluestions Are conrpulsory
SECTIOI{-B
Fig. I
www.aktuonline.com
'Write
Q6. an algorithm for solving n-queen probleffi. Show
the solution of' 4 queen probleln using bracktrarcking
approach,
SECTION-C
Fig: 2
www.aktuonline.com
-"-x---
B.Tech.
(SEM. V) ODD SEMESTER TTIEORY
EXAMINATION 2013.I4
DESIGN AND ANALYSIS OF ALGORITHMS
T(n)=3T(il3)*cn,and
T (n) = 5 T (n/4) * n2 where c is constant and n is the
numberof inputs. Findthe asymptotic bounds.
(i) Selectionsort
(iD Insertionsort.
ECS502/pNG-52025 lTurnOver
uptuonline.com
http://www.UPTUonline.com
uptuonline.com uptuonline.com
20, 30,3 5, 85, I 0, 55, 60,25, 5, 65, 7 0, 7 5, 15, 40,50, 90, 45.
(i) Knrskal'salgorithm
(iD Prim'salgorithm.
(b) What is an optimization problem ? How greedy method
can be used to solve the optimization problem ?
ECS502/pNG-52025
uptuonline.com
http://www.UPTUonline.com
uptuonline.com uptuonline.com
ECS502/pNG-52025 16575
uptuonline.com
http://www.UPTUonline.com