GREATER NOIDA INSTITUTE OF TECHNOLOGY, GR.
NOIDA
PUT, 2017-18
3rd Yr (IT).[Link] (V SEMESTER)
DAA (NCS-501)
Time-3:00Hrs [Link]
Section A
Note: Attempt all parts: 2*10 = 20
(A) What do you mean by an algorithm?
(B) Differentiate between Internal sorting & External sorting.
(C) How partitioning affects complexity in quick sort?
(D) What is minimum cost spanning tree?
(E) Discuss characteristics of dynamic programming.
(F) What do you mean by complexity?
(G) Discuss all major asymptotic notations.
(H) Find big oh notation of f(n) = 9n3 + 4n2 + 19n + 3
(I) Differentiate between divide & conquer and dynamic programming.
(J) Explain 0/1 knapsack & fractional knapsack.
Section B
Note: Attempt any 5 parts : 5*10=50
Q1 (a) Write an algorithm to perform merge sort.
Q1 (b) Write algorithm for RB Tree deletion.
Q2 (a) Discuss Strassen’s matrix multiplication with an example.
Q2 (b) Sort the following set of elements using heap sort 11,32,6,19,31,44,26,7,22
Q3 (a) Discuss Dijkstra’s shortest path algorithm.
Q3 (b) Determine schedule for the following set of jobs:
i 1 2 3 4 5 6 7
Si 3 1 5 6 9 11 12
Fi 5 4 8 8 12 14 16
Q4 (a) Write an algorithm to implement prim’s spanning tree.
Q4 (b) Solve the following travelling salesman problem using dynamic programming. Edges (1,2),(1,3),(1,4),
(2,3),(2,4),(3,4) has weights 4,3,7,15,8,2 respectively.
1 3
2 4
Q5 (a) Write an algorithm for n-queens problem.
Q5 (b) Solve the following graph coloring problem with m=3
2 5
1 4
32 6
Q6 What is Randomized algorithm? Explain with suitable example.
Q7 Discuss decision class problem. Differentiate between NPC & NP hard.
Q8(a) Write algorithm of union operation in binomial heap.
Q8(b) Find LCS of X= 100110 and Y= 110110
Section C
Note: Attempt any two parts: 2*15=30
Q1.a) Write algorithm for KMP matcher.
Q1. b) Parenthesize following set of matrices using dynamic programming:
P 4 3 5 2 3 4
Q2.a) Find an optimal solution to the knapsack instance n=7 objects and the capacity
of knapsack m=15. The profits and weights of the objects are (P1,P2,P3, P4, P5,
P6, P7)= (10, 5,15,7,6,18,3) (W1,W2,W3,W4,W5,W6,W7)= (2,3,5,7,1,4,1)
Q2b) Create Red Black tree from following sequence of element: 12,9,40,48,16,4,56,71,90,18,41
Q3a) Create B-tree of degree 3 from following sequence of elements:
11,88,9,3,16,27,31,34,55,6,41,26,30,39,48,17,5,24
Q3b) Match pattern P= 3241 with text T= 2834324167521 for q=11 using Rabin Karp matcher.