0% found this document useful (0 votes)
68 views

DAA All Year Question Paper

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
68 views

DAA All Year Question Paper

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 25
530, will be treated as malpractice. sn the remaining blank pages. ‘equations written eg, 4268 GAGS SCHISM T {TT TPIT Fourth Semester B.E. Degree Examination, Dec.2018/Jan.2019 Design and Analysis of Algorithms Time: 3 hrs. Max. Marks: 80 Note: Answer any FIVE full questions, choosing ONE full question from each module. jodule-1 1 What is an algorithm? What are the properties of an algorithm? Explain with an example. (04 Marks) Explain the general plan for analyzing the elficieney of a recursive algorithm, Suggest a recursive algorithm to find factorial of a number, Derive its efficiency (08 Marks) IFti(n) € O(gr (n)) and t2(n) € Og: (n)) prove that y(n) + En) © Ofmax gin). 2(0)}) (04 Marks) OR Explain the asymptotic notations with examples. Distinguish between the two common ways to represent a graph Discuss about the important problem types and fundamental data struct (06 Marks) Modu Discuss how quick-sort works to sort an array and trace for the following data set. Draw the tree of recursive calls made, | 65 | 70 | 75 [ s0 | 85 | 60 Derive the best case complexity of quick sort algorithm. (10 Marks) Briefly explain the Strassen’s matrix multiplication, Obtain its time complexity. (06 Marks) OR Explain the concept of divide and conquer. Design an algorithm for merge sort and derive its time complexity (10 Marks) ‘What are the three major variations of decrease and conquer technique? Explain wit example for each (06 Lof3 15CS43 Modutle-3 a. Explain the concept of greedy technique for Prim’s algorithm, Obtain a minimum cost spanning tree for the graph shown in Fig, Q5(a), (08 Marks) 60 0 / 7% Py . bo Fig. Q5(a) b. Solve the below instance of the single source shortest path problem with vertex 6 as the source, With the help of suitable algorithm (08 Marks) ai as ! 2 p29 5 LI A © 20 yee Fig. Q5(b) OR a. What are Huffman trees? Explain, Construct a Huffman code for the following data : Encode DAD_CBE using Huffman encoding, (08 Marks) Explain transform and conquer technique. Sort the below list using Heap sort : 3.2.4, 1, 6 5. (08 Marks) Module-4 4 Define transitive closure of @ graph. Write Warshall’s algorithm to compute transitive closure of a directed graph. Apply the same on the graph defined by the following adjacency matrix 0100 R= ee (08 Marks) 0004 000 b, Using Dynamic programming, solve the below instance of knapsack problem, (08 Marks) tem Weight [ Vale 1 2 12 -_ 1 10 | Capacity w 3 3 20 4 2 15 Tots 15CS43, OR 8 a, Obtain a optimal binary search tree for the folowing four-key set (08 Marks) Key ot dD Probability a 1 “0.2_ 0. 4 | 03 b. Solve the following travelling sales person problem represented as graph shown in Fig. Q8(b), using dynamic programming. (08 Marks) Fig. Q8(b) Modul 9 a. What is the central principle of backtracking? Apply backtracking to solve the below instance of sum of subset problem = {5, 10, 12, 13, 15, 18} d=30. (08 Marks), b. Solve the below instance of assignment problem using branch and bound algorithm, Joby Jub Joby Joh g 2 7 8) Persona ( 6 4 3 7 | Person b g 8 1 8 | Persone l 7 6 9 4) Persond (08 Marks) OR 10 a. Draw the state-space tree to generate solutions to 4-Queen’s problem (04 Marks) b. Apply backtracking to the problem of finding a Hamiltonian cireuit in the graph shown below (04 Marks) Fig.Qi0(a) Define the following, i). Class P ii) Class NP iii) NP complete problem iv) NP hard problem. (08 Marks) taeee 30f3 ining blank pages. Important Note : 1. On completing your answers, compulsorily draw diagonal cross lines onthe '50, will be treated as malpractice. 2. Any revealing of identification, appeal to evaluator and /or equations writen eg, 4248 SCHEME USN 17CS43 Fourth Semester B.E. Degree Examination, Dec.2019/Jan.2020 Design and Analysis of Algorithms ‘Time: 3 hrs. Max. Marks: 100 Note: Answer any FIVE full questions, choosing ONE full question from each module. Module. a. Explain Asymptotic notations in detail with example. (12 Marks) b. Outline an algorithm to find maximum of n elements and obtain its time complexity. (08 Marks) OR a. Design algorithm for tower of Hanoi problem and obtain time complexity. (10 Marks) b, Prove the theorem if fi(n) € 0 (g, (n)) and fy(n) €0 (g2 (n)) Then fi(n) + f(a) € O (max {gi(n), g2(n)}). (10 Marks) Modute-2 a, Design a recursive algorithm for binary search and calculate time complexity. (10 Marks) b. Write the algorithm for merge sort and Trace 60, 50, 25, 10, 35, 25, 75, 30. (10 Marks) OR a. Develop an algorithm for Quick sort and derive its time complexity. (10 Marks) 'b. What is topological sorting? Apply DFS for below graph to solve topological sorting, (10 Marks) Fig.Q.4(b) Modute-3 a, Find the optimal solution to the knap sack instant n= 7, m= 15 using greedy method. Object | 1 [213/45 [6 [7 Weight [02 [03 [05] 07/01 | 04 | 01) Profit | 10 [05 | 15 | 07 [06 | 18 | 03] (10 Marks) b. Find the minimum spanning tree using Kruskal’s algorithm, 16 i 6 —" (10 Marks) 17C843 OR 6 a. Construct a Huffman code for the following data: Characters [A [| B | C] D | - Probability [0.4 [0.1 | 0.2 [0.15 [0.15 Encode the text ABACABAD and decode 10001011 1001010, (10 Marks) b. Calculate the shortest distance and shortest path from vertex 5 to vertex 0 using Dijkstra’s. (10 Marks) Fig. Q.6(b) Modute-4 7 a. Explain the general procedure to solve a multistage graph problem using backward approach with an example, (10 Marks) b. Construct an optimal binary search tree for the followin Items A[B|C]D Probabilities : [0.1 [0.2 [0.4 [0.3 (QO Marks) OR 8 a. Design Floyd's algorithm to find shortest distances from all nodes to all other nodes, (10 Marks) b. Apply Warshall’s algorithm to compute transitive closure for the graph below. (10 Marks) Fig. Q.8(b) © Modute-5 9 a, What is Hamiltonian circuit problem? What is the procedure to find Hamiltonian circuit of a graph? (10 Marks) b. Explain the classes of NP-Hard and NP-complete. (10 Marks) OR 10 a. Apply the branch and bound algorithm to solve the travelling salesman problem for the graph below. Fig.Q.10(a) (10 Marks) b. Obtain the optimal solution assignment problem given: df hls Th alg [2 [7/8 blé [4 [3 [7 clsls|i[s tal7 testa (10 Marks) CBCS Seenae USN | 15CS43 Fourth Semester B.E. Degree Examination, June/July 2018 Design and Analysis of Algorithms ‘Time: 3 hrs. Max. Marks: 80 Note: Answer any FIVE full questions, choosing ONE fall question from each module. Module. 1a, Write an algorithm to find the maximum element in an array of n element. Give the mathematical analysis of this non-recursive algorithm. (06 Marks) b. Explain the asymptotic notations BigO, BigO and big theta used to compare orders of growth of an aigorithm, (06 Marks) ¢. Explain with an example how a new variable count introduced in a program can be used to find tite number of steps needed by a program to solve a particular problem instance. (04 Marks) OR 2a. Write a recursive function to find and print all possible permutations of a given set of n elements, (05 Marks) b. Salve the recurrence relation : M(n) = 2M(n — 1) + 1. Take M(I) = 1, M(n) is given for api. (05 Marks) ©. Define algorithm, What are the criteria that an algorithm must satisfy? (06 Marks) Module-2 3° 4 Write a function to find the maximum and minimum elements in a given array of n elements by applying the divide and conquer technique. (06 Marks) b. Explain the divide and conquer technique. Give the general algorithm DAndC(P)[Where P is the problem to be solve] to illustrate this technique. (04 Marks) c. Apply source removal method to obtain topological sort for the given graph in Fig.Q3(c). (06 Marks) Fig.Q3(c) OR 4a. Explain the merge sort algorithm. Illustrate with an example and give the worst case efficiency of merge-sort. (08 Marks) b. Apply quick sort algorithm to the following set of numbers. 65, 70, 75, 80, 85, 60. 55, 50, 45. (08 Marks) 1of3 15CS43 Module. a. Apply greedy method to obtain an optimal solution to the knapsack problem given M = 60, v1, Wa, Wa, Ws, Ws) = (5, 10, 20, 30, 40) (Ps, pz, Ps Ps, Ps) = (30, 20, 100, 90, 160). Find the total profit earned. (04 Marks) 6. Explain Huffman algorithm. With an example show the construction of Huffman tree and generate the Huffman code using this tree (06 Marks) c. Apply Prim’s algorithm to obtain a minimum spanning tee for the given weighted connected graph. [Fig.Q5(c)}. (06 Marks) Fig.Q5(c) OR a, Explain the bottom up heap construction algorithm with an example. Give the worst case efficieney of this algorithm, (08 Marks) b. Apply single source shortest path problem assuming vertex a as source.[Refer Fig.Q6(b)]. (08 Marks) ig.Q6{b) a. Explain multistage graph with ai example. Write multistage graph algorithm using backward approach. (08 Marks) b. Apply Floyd’s algorithm to soive all pair shortest path problem for the graph given below in Fig.Q7(b). (08 Marks) Fig.Q7(b) 20f3 15CS43 OR Explain Bellman Ford al to find shortest path from single source to all destinations for a directed graph with negative edge cost (08 Marks) Apply Warshall’s algorithm to the digcaph given below in Fig.Q8(b) and find the transitive closure. (08 Marks) ‘OL Fig.Q8(b) Module-5 Apply backtracking method to solve subset-sum problem for the instance d = 30 and $= {5, 10, 12, 13, 15, 18}. Give all possible solutions. (08 Marks) Explain how travelling salesman problem can be solved using branch and bound technique. (06 Marks) Define deterministic and non deterministic algorithms (02 Marks) OR What is Hamiltonian cycle? Explain the algorithm to find the Hamiltonian eycle in a given connected graph. Write the functions used for generating next vertex and. for finding Hamiltonian cycles. (09 Marks) Apply the best-first branch-and-bound algorithm to solve the instance of the given job assignment problem. (07 Marks) Jobl Job2 Job3_Job4 9 92 7 8) Persona 4 3 7 | Person b 8 1 8 | Persone 6 9 4_) Persond veer 30f3 BES SCHEME usN LLTTT TT LL 17843 Fourth Semester B.E. Degree Examination, June/July 2019 Design and Analysis of Algorithms Time: 3 hrs. Max. Marks: 100 4 Note: Answer any FIVE full questions, choosing ONE full question from each module. & Module-1 2 1 a Design an algorithm to search an element in a array using sequential search. Discuss the a ‘worst case, best case and average case efficiency of this algorithm, (08 Marks) i b, Discuss adjacency matrix and adjacency list representation of a graph with suitable example, (06 Marks) a3 ©. Give the recursive algorithm (o solve towers of Hanoi problem. Show that the efficiency of ag this algorithm is exponential (06 Marks) aa = OR 24 2 a. Give the general plan for analyzing time efficiency of non recursive algorithms. Derive the 5 ‘worst case analysis for the algorithm to check whether all the elements in a given array are : distinct. (08 Marks) 3 b. List and define any three asymptotic notations. What are the various basic asymptotic a efficiency classes? (06 Marks) ©. Explain the following types of problems (i) Combinatorial problems (ii) Graph problems, (06 Marks) Modute-2 3° a. Write an algorithm to sort ‘n’ numbers using Quick sort. Trace the algorithm to sort the following list in ascending order. 80 60 70 40 10 30 30 20 (08 Marks) b. Discuss general divide and conquer technique with control abstraction and recurrence appeal to evaluator and or equations written eg, 42+ z relation. (06 Marks) : c. Apply DFS based algorithm and source removal method to find the topological sequence for g the graph shown in Fig.Q3(c) (06 Marks) i Re 4 L JS s 3 Fig.Q3(c) gs 2B OR ©< 4 a Apply Strassen’s matrix multiplication to multiply following matrices. Discuss how this a method is better than direct matrix multiplication method. i 21)"l1 6 A 6. Write recursive algorithm to find maximum and minimum element in an array. (06 Marks) 4 ©. Write an algorithm to sort ‘n’ number using merge sort. (06 Marks) 1of2 17843 Modu! Write an algorithm to solve knapsack problem using Greedy technique, Find the optimal solution to the knapsack instance n = 7, m= 15 (Pj, Po...--.-P2) = (10, 5, 15, 7, 6, 18, 3) (Wy, Wa....Ws) = Q, 3,5, 7, 1.4, 0) (10 Marks) Apply Prim’s algorithm and Kruskal’s method to find the minimum cost spanning tree to the ‘graph shown in Fig Q5(b). (10 Marks) y Fig.Q5(b) OR Write an algorithm to solve single source shortest path problem. Apply the algorithm to the graph shown in Fig.Q6(a) by considering ‘a’ as source. (10 Marks) Fig. Q6(a) Define heap. Write bottom-up heap construction algorithm. Construct heap for the list 1, 8, 6,5, 3, 7,4 using bottom-up algorithm and successive key insertion method. (10 Marks) Module-4 Define transitive closure of a directed graph. Find the transitive closure matrix for the graph whose adjacency matrix is given 1001 0} 0100 0) ooort (10 Marks) 10000 o1root Find the optimal tour for salesperson using dynamic programming technique. The directed graph is shown in Fig.Q7(b) (10 Marks) , io ¥ B Ai 3 rs Fig.Q7(b) 20f3 10 17€843 OR Write an algorithm to construct optimal binary search tree for the following data: Ke B | c | D [ Probability or [02 [04 [03 (10 Marks) Apply the bottom-up dynamic programming algorithm to the following instance of the knapsack problem. Knapsack capacity W = 10. Item Weight Value 1 7 a2 2 3 12 3 4 40 4 s 25 (10 Marks) Module-5 Construct state-space tree for solving four queens problem using backtracking. (06 Marks) Discuss graph coloring problem, Find different solutions for 4 nodes and all possible 3 coloring problem (06 Marks) Write a note on: (i) Non deterministic algorithms. (ii) LC branch and bound solution to solve Off knapsack problem (08 Marks) OR What are the two additional items required by Branch and Bound technique, compared with backtracking. Solve the following assignment problem using branch and bound technique, ‘whose cost matrix for assigning four jobs to four persons are given 9278 6437 (10 Marks) 5818 71694 Discuss the following (3). Subset sum problem (i) NP hard and NP complete classes. (10 Marks) 30f3 CG3CS Scheie Aourth Semester B.E. Degree Examination, Dec.2017/Jan.2818 Design and Analysis of Algorithms 15C843 Time: 3 hrs. Max. Marks: 80 Note: Answer aay FIVE full questions, choosing one full question from each module. Moai 1a, Define an algorithm. Discuss the criteria of an algorithm with an example. (06 Marks) b. Prove that : If(n)¢0¢g\(n)) and 3(n)< O(g2(n)) then tn) +tXnjeO (max{ gin), go(A)}) (06 Marks) ©. Explain the two common ways to represent a graph with an example (08 Marks) OR 2 a, Consider the following algorith Algorithm GUESS (AL ][) 4. f 2 fori—Oton-1 : forj—0 toi a Ali 1-0 2 i) What does the algorithm compute? z ii) What is basic operation? é iii) What is the efficiency of this algoritisn? (03 Marks) = b. List and explain important problem types that are solved by computer. (07 Marks) 3 ¢. Design an algorithm for checking whether all elements in a given array are distinct or not. 7 Derive its worst complexity. (06 Marks) 3 Module-2 23 3 a. Explain divide and conquer technique. Write a recursive algorithm for finding the maximum > and minimum element from a list (08 Marks) 3 b. Apply quick sort to sort the list E, X, A. M, P, L, E in alphabetical order. Draw the tree of 2 the recursive calls made. (08 Marks) OR ¢ 22 4 a. Discuss Strassen’s matrix multiplication and derive its time complexity (08 Marks) : b. Design merge sort algorithm and discuss its best-case, average-case and worst-case 3 efficiency. (08 Marks) 2a Modi EE 5 a, Solve the greedy knapsack problem where ge m= 10,n=4, P = (40, 42, 25, 12), W=(4, 7,5, 3). (05 Marks) aa b. What is job sequencing with deadlines problem? Let n= 5, profits [10. 3. 33, 11. 40} and 2 deadiines [3, 1, 1, 2,2] respectively. Find the optimal solution using greedy algorithm. 3 (05 Marks) : c. Define minimum cost spanning tree (MST), Write Prim’s algorithm to construct minimum 5 ‘cost spanning tree. (08 Marks) z lof: 15CS43, OR Design Dijkstra’s algorithm and apply the same to find the single source shortest path for aph taking vertex ‘a° as source of Fig. Q6(a). (68 Marks) Construct a Huffman code for the following data : Character | AB CD - Probability [04 0.1 0.2 0.15 0.15 Encode the text ABACABAD and decode the text 1000101 11001010, using the above code. (04 Marks) Construct the heap for the list 2, 9, 7, 6, 5, 8 by the bottom-up aigorithm. (04 Marks) Module-4 Define transitive closure. Write Warshall’s algorithm to compute transitive closure. Find its efficiency. (08 Marks) Apply Floyd’s algorithm to find all pair shortest path for the graph of Fig. Q7(b). (08 Marks) 2 @) Fig. Q2(b) OR For the given cost matrix, obtain optimal cost tour using dynamic programming, (08 Marks) 0 10 15 20 50 9 0 6 130 12 |s 8 9 0] Fig. Q8(a) Write a pseudocode to find an optimal binary search tree by dynamic programming. (08 Marks) Modute-5 Write the pseudocode for backtracking algorithm. Let w = {3, 5, 6, 7} and m= 15 ind all possible subsets of w that sum to m. Draw the state space tree that is generated. (09 Marks) Draw the portion of the state space tree for m — colorings ofa graph when n= 4 and m= 3. (07 Marks) OR With the help of a state space tree, solve the Travelling Salesman Problem (TSP) of Fig. Q10(a), using branch-and-bound algorithm. (08 Marks) ao 5 . Explain the method of compuring the order of growth of two functions using limits, compute i the order of growth of (i) logsmand Vn (ii) 2" and nt (us Marks) a2 OR £3 2 a Define Big Oh notation, Prove that if t(n)e O(n) and tin) O%etn”) then 38 1\(n) + (1) € Ofmax fg, (n).g-(n)} ) (08 Marks) 2 >. Explain the general plan for analyzing the efficiency of a recursive algorithm by considering $ ‘Tower of Honoi problem as an example. (08 Marks) 3 lodule-, Modute-3 5 a. Write the algorithm to find optimal solution for job sequencing problem with deadline, Apply the same algorithm for the following dataset and find an optimal solution, ps. ps) = (100, 10, 15.27). dh, di) = 1,2, 1) (08 Marks) — 3° a, Explain the concept of divide and conquer. Design and algorithm for menge sort, (8 Marks) Be b. Apply Stressen’s matrix multiplication algorithm w compute preduct of following two ay 4 13 a3 matrices: * 08 Marks ae F i [: 41 ‘ 7 23 23 or 38 4 a. Discuss how Quick sort works to sort an array. Trace Quick sort algorithm fr the following a3 data set: 2, -4, 1, 0, 3, 5.—7. Also derive the worst case time complexity of Quick sort Be (0 Marks) 24 b. Design and analyse an algorithm for findings the maximum and minimum of an elements EE using Divide and Conquer Approach (8 Marks) g 5 2 of identfcat n=4, Profit (pi. p2 Deadlines: (di, d 3 . Write a Kruskal’s algorithm t find minimum cost spanning tree and obtain minimum: Be spanning tree for the graph shown in Fig.Q5(b). se vo OL 2a 3 & @ i (08 Marks) 6 10 b, b, 15CS43, OR ‘What is an Heap? Write an algorithm to sort the elements using Heap Sort. (08 Marks) Obtain the shortest distance cost and paths from node Sito other nodes from the graph shown in Fiz. Q60b). Fig.Q6(b) (08 Marks) Modute~s Write WVarshall’s algorithm and find the transitive closuite of the matrix given below: o 10 0) Re wool (08 Marks) uo 000 | fot of Explain multistage graphs with example, Write multistage graph algorithm using forward approach, (08 Marks) OR Using dynamic programming, solve the following knapsack instance: ned. [wee Wo, Ws, Wa) = [2.1321 Ips. ns: ps. pa) = [12, 10, 20, 15] and M=5 (08 Marks) Solve the following traveling sales person problem using dynamic programming. 0 10 15 20 50 9 10 starting city | (08 Marks) 6B 0B [ss 90 Modute-s 8 bucktiacking algorithm, Draw the state space tree for 4 — Queen's problem. (08 Marks) Solve the following instance of Knapsack problem using Branch and Bound Approach, 1 4. [W135 We Wa] = [ATES 3s [vue V2e Ve a] = [405 42, 25, 12] The knapsack's eapacity w is 10. (08 Marks) OR Deline PNPLNP - complete and NP ~ Hard elasses. (08 Marks) Solve the following instances of assignment problem using Branch and Bound. Jub] Job2 Job3 Job4 [9 2 7 &)persona 3 437 |personb (08 Marks) 8 8 ]persone 7 6 9 — Alpersond 2of2 CaCS SCHEME USN | 15C843, Fourth Semester B.E. Degree Examination, July/August 2021 Design and Analysis of Algorithms Time: 3 hrs. Max. Marks: 80 Note: Answer any FIVE full questions. 1 a If t(n)eO(g,(n)) and t,(n)€O(g, (n)), prove that ,(n) +1,(n)€O (max(g,(n),g,4n)). (06 Marks) Consider the following algorithm, Algorithm Enigma (A[0.....—1,0......-I)) for i->0 to n-2do for jit ton it Alii al return False end For end For return True (]) What does the algorithm compute? (ii) What is the basie operation? (ii) How many times the basic operation is executed? (iv) What isthe efficiency class ofthe algorithm? (05 Marks) ©. By using limits compare the order of growth ofthe following: () — togyn and Vn. Gi) nt and 2" (05 Marks) be treated as malpractice. s do. son the roma rand for equations writen ey, 42 agonal eross 2 a. If M(n) denotes the number of moves in towers of honoi puzzle, when n disks are involved, Give a recurrence relation for M(n) and solve the recurrence relation. (06 Marks) b. Define basic three asymptotic notations with example. (06 Marks) c. Define with example, (i) Stack (ii) Graphs Gi) Trees (iv) Sets and Dictionaries. (04 Marks) 3 a. Write Merge Sort algorithm and discuss its efficiency. Sort the list E, X, A, M, P, L, & in alphabetical order. (08 Marks) b. Write recursive algorithm to find minimum and maximum element in a set of n elements by using divide and conquer and find the minimum and maximum element in the set 29, 4, 88, 15, 9, 87, 14, 1 (08 Marks) 4 a. Write Quick Sort Algorithm. Sort 5, 3, 1,9, 8, 2, 4, 7 in ascending order and write the tree of recursive calls to quicksort algorithm. (08 Marks) Lof3 15CS43 Solve the recurrence relation by using backward substitution method. (Solve for n= 2") a(2}s2 2}? itnaa Tiay=41 ifn=2 (08 Marks) 0 ifn= Write and explain Greedy Knapsack algorithm. (04 Marks) What is minimum cost spanning tree? Explain with an example, Find minimum cost spanning tree for weighted graph given in Fig. Q5 (b) using Prim’s algorithm, with source vertex I (07 Marks) Fig. QS (b) For n = 4, profits (P1, Pa, Ps, Pa) = (100, 10, 15, 27) and deadlines (dj, do, ds, da) = (2, 1, 2, 1) Find all the feasible solutions and optimal solution for Job sequencing with deadlines problem, (05 Marks) Write Dijkstra’ algorithm. Apply Dijikstra’s algorithm on the graph given in Fig. Q6 (a), to obtain the shortest paths from source vertex | (08 Marks) Fig, Q6 (a) Sort the array 3, 2, 4, 1, 6, $ by using heapsort with array representation of heaps in increasing order. (04 Marks) Write Kruskal’s algorithm, (04 Marks) Using Warshalls algorithm, obtain transitive closure of matrix for the graph given in Fig. Q7 (a) (08 Marks) —_ Fig. Q7 (a) Using dynamic programming solve the following knapsack instance. For n = 4, M = $, (vi, Way Wa, Ws) = (2, 1,3, 2) and (Pr, Pa Ph, Ps) = (12, 10, 20, 15) (08 Marks) 20f3 15C843, 8 a. Write Floyd's algorithm, Find all pair shortest path for the graph given in Fig, Q8 (a) (08 Marks) b. Write short note o (Reliability design. Gi) Optimal binary search tree algorithm and its efficiency. (08 Marks) 9 a. Write the pseudocode for backtracking algorithm. Apply backtracking to solve the instance ofthe sum of subset problem. S = {3, 5, 6, 7) and d = 15. (08 Marks) b. Write short note om: (i) N Queen's problem (il) Hamiltonian cycles. (08 Marks) 10 a. With the help ofa state space tree, solve the following salesperson problem for graph given in Fig, Q10 (a), using branch and bound algorithm, (08 Marks) ou ne iT + 4 @ 7 Fig. Q10 (a) b. Write short note on: () Non deterministic algorithm (i) Graph Colouring P, NP problems NP hard class (08 Marks) 3083

You might also like