0% found this document useful (0 votes)
38 views25 pages

ADA PYQ's

The document outlines examination questions for a Fourth Semester B.E. Degree in Design and Analysis of Algorithms, covering various topics such as algorithms, data structures, and complexity analysis. It includes modules with questions on recursive algorithms, sorting techniques, greedy methods, dynamic programming, and graph theory. Students are instructed to answer five full questions, selecting one from each module, with a focus on demonstrating understanding of algorithm efficiency and problem-solving techniques.

Uploaded by

Thanu Shree J N
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)
38 views25 pages

ADA PYQ's

The document outlines examination questions for a Fourth Semester B.E. Degree in Design and Analysis of Algorithms, covering various topics such as algorithms, data structures, and complexity analysis. It includes modules with questions on recursive algorithms, sorting techniques, greedy methods, dynamic programming, and graph theory. Students are instructed to answer five full questions, selecting one from each module, with a focus on demonstrating understanding of algorithm efficiency and problem-solving techniques.

Uploaded by

Thanu Shree J N
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 USN GAGS SCHISM LL TTT11 1 Time: Fourth Semester B.E. Degree Examination, Dec.2018/Jan.2019 Design and Analysis of Algorithms 3 hrs, Max. Marks: 80 Note: Answer any FIVE full questions, choosing ONE full question from each module. jodule-1 What is an algorithm? What are the properties of an algorithm? Rxplain witht an example. (04 Marks) Explain the general plan for analyzing the efficiency ofa recursive algorithm, Suggest a recursive algorithm to find factorial of a number. Derive its/effigighcy, (08 Marks) 1ft,(m) € Oat (n)) and t3(n) € O(g (n)) prove thty(n) Pr(n) €O(max }g\(n), g(n)}) (04 Marks) OR Explain the asymptotic notations with examples, Distinguish between the two,¢ommon ways to-represent a graph Discuss about the important problem types and fundamental data struct (06 Marks) % 2 Modu Discus 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 s | 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 Module-3 15CS43, 5 a. Explain the concept of greedy technique for Prim’s algorithm, Obtain a minimum cost & matrix = lodul spanning tree for the graph shown in Fig.Q5(a). (08 Marks) a 30 Fig. Q5(a) b, Solve the below instance of the single source shortest path problem as the source. With the help of a suitable algorithm. Marks) 6 a, What are Huffman trees? Expl finan code for the following data : CTDTET—- 05 [01 [04 | 02 Encode DAD. (08 Marks) bo Explain que. Sort the below list using Heap sort (08 Marks) closure of @ graph. Write Warshall’s algorithm to compute transitive graph. Apply the same on the graph defined by the following adjacency (08 Marks) b, Using Dynamic programming, solve the below instance of knapsack problem, (08 Marks) alo ote ooo4 00 00 item] Weight | Value pt 2 12 2 1 10 3 3 20 4 2 15 Tots Capacity w= 5 15CS43, OR 8 a, Obtain a optimal binary search tree for the folowing four-key set (08 Marks) Key eye Probability Hi 02 | 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 = 15, 10, 12, 13, 15, 18} d=30, (08 Marks), b. Solve the below instance of assignment problem using braheh and bound algorithm, 0b, Too, Jab Job, 9 2 " 8) Persona "a (n)) Then fi(n) + (n) € O (imax {2x¢n), ga(n)}). (10 Marks) Modute-2 a. Design a recursive algorithm for binary scarch and calculate time¢omplexity. (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 eomplexity. (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 5S [6]? 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. \ i 6 —" (10 Marks) 17843 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..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 [04 [0: (10 Marks) oR 8 a. Design Floyd’s algorithm to find shortest distan¢es from all nodes to all other nodes. (10 Marks) b. Apply Warshall’s algorithm to computestransitive 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 aid/bound algorithm to solve the travelling salesman problem for the ‘graph below Fig.Q.10(@) (10 Marks) b. Obtain the optimal solution assignment problem given: J [1b [Ie alg [2 [7/8 ble |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 elemientyGive the mathematical analysis of this non-recursive algorithm. (06 Marks) b. Explain the asymptotic notations BigO, BigO and big theta(tised to compare orders of growth of an aigorithm, (06 Marks) ©. Explain with an example how a new variable count introduced in program ean 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 allfBossible petmutations of a given set of n elements. (05 Marks) b. Salve the recurrence relation : M(n)= 2M(n — 1) Lake M(1) = 1. M(n) is given for api. (05 Marks) © Define algorithm. What are the criteria that an alg6fithm must satisfy” (06 Marks) Modute-2 3° Write a function to find the'tiaximum and minimum elemeats in a given array of elements by applying the divide aitd conquer. technique. (06 Marks) ». Explain the divide and eonquer technique. Give the general algorithm DAndC(P)[ Where P is the problent to be solve}to illustrate this technique (04 Marks) c. 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. 5 a. Apply greedy method to obtain an optimat solution to the knapsack problem given M = 60, OWL, Wa, Ws, Wa, Ws) = (3. 10, 20, 30, 40) (Pr, P2, Ps, Pas 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 6 a. Explain the bottom up heap construction algorithmyith an example. Give sic worst case efficiency of this algorithm, (08 Marks) b. Apply single source shortest path problem assuming verteN’a as source.[Refer Fig.Q6(b)]. (08 Marks) Fig. Q6«b) Med 7 a. Explain nvultistage graph with a 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 10 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) @ ) Fig.Q8(b) 7 Module-5 Apply backtracking method to solve subset-sum_proble nce d = 30 and S$ = {5, 10, 12, 13, 15, 18}. Give all possible solutions. (08 Marks) explain how travelling salesman problem can be solved usit bound technique. (06 Marks) Define deterministic and non deterministic algoril (02 Marks) What is Hamiltonian cycle? Explai qos Hamiltonian cycle in a given connected graph. Write the funct ed foregenerating next vertex. and. for finding Hamiltonian cycles. (09 Marks) Apply the best-first_branch-and- (0 solve the instance of the given job assignment problem. (07 Marks) 3 Jobs 8) Persona 7 | Person b 8 | Persone Person d 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) 42 ©. Give the recursive algorithm (o solve towers of Hanoi problem. Show thaf the efficiency of 33 this algorithm is exponential (06 Marks) ae Bh OR 2% 2 a. Give the general plan for analyzing time efficiency of non recursive algorithms. Derive the ae ‘worst case analysis for the algorithm to check whether all the éléments in a given array are 3 distinct. (08 Marks) aE b. List and define any three asymptotic notatidns. What are the various basic asymptotic a efficiency classes? (06 Marks) q ©. Explain the following types of problems B (i) Combinatorial problems (ii) Graph problems. (06 Marks) 3 Module-2 £ 3. a. Write an algorithm to sort sn” nuumbersusing Quick sort. Trace the algorithm to sort the a following list in ascending order. § 80 60 70 40 10 30 30 20 (08 Marks) 3 b. Discuss general divide)and conqlier technique with control abstraction and recurrence £ Z relation (06 Marks) : c. Apply DES based algorithm and source removal method to find the topological sequence for g the graph shown in Fig.Q3(c) (06 Marks) é a4. L JS $2 Fig.Q3(e) ay Bs ze OR ©< 4 a Apply Strassen’s matrix multiplication to multiply following matrices. Discuss how this a method is better than direct matrix multiplication method. 3 43] [2 5 z x (08 Marks) 5 21)"l1 6 b 6. Write recursive algorithm to find maximum and minimum element in an array. (06 Marks) ©. Write an algorithm to sort ‘n’ number using merge sort. (06 Marks) 1of2 17843 Modul 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) rn" 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 all rithm. 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 aidireeted graph. Find the transitive closure matrix for the graph whose adjacency matrix is given. 10040 oo 00 ooo1t (10 Marks) 100 00 o1oot Find the optimal tour for salesperson using dynamic programming technique. The directed ‘graph is shown in Fig. Q7(b). (10 Marks) , > % B ally 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 o1 | 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) L€ brafielr and bound solution to solve Off knapsack problem (08 Marks) OR What are the two additional item Fequired by Brafich 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 9 6 5 8 7 (1oMarks) g 4 7 Discuss the following : 3) Subset sum problem ityNP hard and NP complete classes. (10 Marks) 30f3 CBCS Setiemae L | 15C843 Aourth Semester B.E. Degree Examination, Dec.2017/Jan.2818 Design and Analysis of Algorithms 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. 16 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 eSample (04 Marks) OR 2a. Consider the following algorith Algorithm GUESS (Al ][) forieOt0n—1 for j — toi Ali G1—0 i) What does the algorithm compute? ii) What is basic operation? iii) What is the efficiency ofthigalgorithm? (03 Marks) b, List and explain important problem types that argysolved by computer. (07 Marks) ©. Design an algorithm for checking whether all elements in a given array are distinct or not. Derive its worst complexity, (06 Marks) Modul 3) a, Explain divide and congip technique, Write a recursive algorithm for finding the maximum and minimum ¢lement from alist (08 Marks) Ae b. Apply quick’sortifo Sort the list B)X. A.M, P. L, E in alphabetical order. Draw the tree of eb the recuifsive ealls made. (08 Marks) gi OR 22 4 a@Discuss Strassen’s matrix multiplication and derive its time complexity (08 Marks) : 6. Design. merge sort algorithm and discuss its best-case, average-case and worst-case 3 efficiency. (08 Marks) i Mod: ££ 5 a, Solve the greedy knapsack problem where £2 m= 10, n=4, P= (40, 42, 25, 12), W= (4, 7, 5,3). (06 Marks) ae 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 (0S Marks) a ¢, Define minimum cost spanning tree (MST), Write Prim’s algorithm to construct minimum L cost spanning tree. (08 Marks) z Lof2 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. 104 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 Floyds algorithm to find all pair shortest path for the ge€ph, of Fig. Q7(b). (08 Marks) > 2 T Fig. Q7(b) OR For the given cost matrix, obtain optintal cost tountiSing dynamic programming, (08 Marks) @ 10 15 20 50 9 10 6 13 0 12 r ls 8 9 0} Fig Q8(a) Write a pseudoeade 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, Find all possible sitbseis\of w that sum to m. Draw the state space tree that is generated. (09 Marks) Draw the paitionof 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 % B ally 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 o1 | 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) L€ brafielr and bound solution to solve Off knapsack problem (08 Marks) OR What are the two additional item Fequired by Brafich 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 9 6 5 8 7 (1oMarks) g 4 7 Discuss the following : 3) Subset sum problem ityNP hard and NP complete classes. (10 Marks) 30f3 SCHEME USN LI | 17843 Fourth Semester B.E. Degree Examination, Aug./Sept.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, ¢ Modute-1 G1 a. Define an algorithm. Explain the characteristies of an algorithm. (04 Marks) & 'b. What are Asymptotic notations? List and describe the various asymptotic fotations with an 2 example of each, (05 Marks) c. Explain the general plan of mathematical analysis of non“¥ecursive algorithm with an i example. (08 Marks) 7 OR = 2 a, What is the worst case, best case and average case efficienties of sequentialsearch? 2 (04 Marks) 4 ». Illustrate mathematical analysis of recursive algorithm fos Towers of Hanoi problem $ (8 Marks) ? ¢. Discuss the important problem types and fundamental data structures. (08 Marks) draw diagonal cross lines on the remaining blank pages. 2 3. a. Discuss how Quick sort algorithm works to sort an atray and trace for the following data set. 2 Draw the tree of recursive calls made. & 25 [1 [463s | 82 | t4 [55] 5 Derive best case complexity of quick sort algorithm. (10 Marks) Ve 'b. Obtain the topological sorting for the digraph shown in Fig.Q3(b), using source removal s method. Sat © ©) Fig.Q3(b) (06 Marks) c, List out the advantages and disadvantages of divide and conquer technique. (04 Marks) OR 4 a. Explain divide and conquer technique with its control abstraction. (04 Marks) b. Develop an algorithm for sorting elements using Simple merge. Apply the same for sorting list of elements given below: eaonnee (o7_[90 | 12 | 56 | 23 | 34 | 45) (aa are) c. Apply Strassen’s algorithm to compute flo2t)foror #31. zi1a4 a (08 Mois a1 #0 2814 O71 Taas@ lof 17C843 Modute-3 State Job sequencing with deadline problem. Find the solution generated by job sequencing problem for 7 jobs given profits 3, 5, 20, 18, 1, 6, 30 and deadlines 1, 3, 4, 3, 2, 1, 2 respectively. (04 Marks) Explain the concept of greedy technique for Prim’s algorithm. Obtain a minimum cost spanning tree for the graph below in Fig.Q5(b). 1 Fig. Q5(b) (08 Marks) Sort the given list of number using Heap sort: Cs eee 6 5 4 3 (08 Marks) oR |. Explain Greedy criterion. Apply greedy method forthe, following instance of knapsack problem. Capacity of the knapsack (M) = 5, tem _|_ We Value T S12 zi $10 3 $20 4 SIS (08 Marks) Construct a Huffman code forthe following ata and encode the test BADEC. Character A | Ge be [ EF | Probability | 04 J 01 | 02 | 0.15 | 0.15 | (06 Marks) Solve the bel6w instaniee (Fig.Q6(¢)) of single source shortest path problem with vertex a as the source (06 Marks) 4 What is Dynamic programming? Using Warshall’s algorithm, obtain the transitive closure of the graph defined by the following adjacency matrix. i (04 Marks) a c ) 0 2of4 170843 Define multistage graph problem. Determine the minimum cost path fiom souree (S) to sink (T) for the graph in Fig.Q7(b) using forward approach. Fig.Q7(b) (06 Marks) Solve the below instance of Bellman-Ford ae thm [Fig.Q7(e)}, Tp Fig Qe) (10 Marks) OR Explain Travelling Salesperson, Problem (TSP). Solve the below instance of TSP using dynamic programming. 1 2 a T{ 0 | 10 (ae) 2a 2) 5 9 10 3] 6 | iii OF 2 4 | 8 8 9 0 (08 Marks) Obtain optimal Binary search Tree for the following identifiers. 1 2 3 4 afi] [don] if | int_| while pil @injeo2 | 04 | 03 | (12 Marks) Draw the state-space tree top generate solutions to 4-Queen’s problem. (04 Marks) Apply backtracking technique to solve the below instance of the subset sum problem s= (3,46) d=7 (08 Marks) Apply Branch_and_Bound technique to the following insurance of assignment problem, jobl job2 job3 jobs 9 92 7 8)Person a eo Person b c-| (08 Marks) < & ae 1 8 | Person ¢ 4| Person d 30f4 17CS43 OR How the Branch_and_Bound technique is different from backhacking? Solve the following insurance of knapsack problem using Branch and Bound technique. Give knapsack capacity = 10. Item i ae [a Weight | 4 |_7 | 5 | 3 Valve 40 [az [9s (08 Marks) Define Hamiltonian cycle. Check whether the Hamiltonian eyele exists for thé!graph given below in Fig.Q10(b), Fig.Q10(b) (04 Marks) Define the following (Class PGi) Class NP (iii) NP Complete Problem, (iv) NP Hard Problem. (08 Marks) 4o0f4 - B68 SCRE USN ] ELE] 15C843 Fourth Semester B.E. Degree Examination, Jan./Feb. 2021 Design and Analysis of Algorithms Time: 3 hrs. Max. Marks: 80 Note: Answer au FIVE full questions, choosing ONE full question from each module. 2 Modul #1 a. Explain the worst case, best case and averaue case efficiencies of am algoritlam, with an a example each ease. 408 Marks) 2 b. Explain the method of comparing the order of growth of two functions sity LamitSeeompute i the order of growth of (i) logsmand Vn (ii) 2" and nt (08 Marks) a2 OR £3 2 a Define Big Oh notation. Prove that if tin) eO(@Mend Lehp= Oren) then 38 1,(n) + (,(n) € Ofmax fg, (n).2.(n)} ) (08 Marks) 2 b. Explain the general plan for analyzing the efficiengyofia reeursive algorithm by considering $ ‘Tower of Honoi problem as an example. (08 Marks) 3 Modute-2 2 3° a, Explain the concept of divide and eonquer. Design andlalzorithm for merge sort. (8 Marks) ba b. Apply Stressen’s matrix multiplication algorithm t-eompuic product of following Wwe cv wdc [2 eft 4 8 Marks b s sl os (08 Marks) as 33 or 32 4° a. Discuss how Quick sont. works to Sort an array. Trace Quick sort algorithm fr the following a3 data set: 2, —4, 1. 063, 5,27. Also derive the worst case time complexity of Quick sort Be (08 Marks) 24 b. Design and analyst an algorithm for findings the maximum and minimum of an elements EE usiig Divide and Conquer Approach (8 Marks) Be jodule-3 22 5 Gi Write the algorithm to find optimal solution for job sequencing pmblem with deadline. A +, Apply the same algorithm for the following dataset and find an optimal solution Be n= 4 Profit (pi. p2. Ps. ps) = (100, 10, 15. 27). Ze Deadlines: (dy, dh, da) = 21,2, (08 Marks) 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). éf to 28 2 (08 Marks) 15CS43, OR 6 a, What is an Heap? Write an algorithm to sort the elements using Heap Sort. (08 Marks) b, Obtain the shortest distance cost and paths from node 5:to other nodes from the graph shown in Fig. Q6(b. Fig.Q6(b) (08 Marks) Modute-t 7 a, Write Warshall’s algorithm and find the transitive closure ofthe Pnatrix givem below: 0 1 0 0 rep oot (08 Marks) ju 000 | fot of b. Explain multistage graphs with example. Write, ritlkistage graph algorithm using forward approach, (08 Marks) OR ' 8 4, Using dynamic programming, salve the following knapsaék instance nod [we Wo, Ws, WPAN 3,2), Ips. ns: ps. pa) = [12, 10, 20,1 Sand MES. (08 Marks) b. Solve the following traveling sales personiproblem using dynamic programming. 0 10 15 20) 5 08 A. carting ity (08 Marks) oer (eMarks [xa 0 Modute-s 94 Disetss the general huektiacking algorithm. Draw the state space tree for 4 — Queen’s problem, (08 Marks) b. Solye the following instance of Knapsack problem using Branch and Bound Approach, 1 Alin, Waa 5. 4] = (4.765, 3), [Vie Vos ve val = [40 42, 25, 12] “The Knapsak’s capacity w is 10, (08 Marks) OR 10 a, Define P.NPLNP-- complete and NP ~ Hard elasses. (08 Marks) b, Solve the following instances of assignment problem using Branch and Bound. Jub] Job2 Job3 Job4 [9 2 7 &)persona a 43 TIpersonb (08 Marks) 8 1 8 persone L769 AI persond 2of2 CaCS SCHEME | 15C843, Fourth Semester B.E. Degree Examination, July/August 2021 Design and Analysis of Algorithms Time: 3 hrs. Max. Marks: 80 son the roma 5 : i t 3 agonal eross Note: Answer any FIVE full questions. If 44) € O(g(n)) and 14(n) € O(@,(m)), prove that y(n) +1,(n)€O (omax(g,(n),g5¢n) (06 Marks) Consider the following algorithm, Algorithm Enigma (A[0.....—1,0......-I)) for i->0 to n—2do for j>i+1 to n=1do it Afileal return False end For end For return True (i) What does the algorithm compute? (ii) What is the basic operation? Gi) How many times the basic operation is executs@? (iv) What is the efficiency class of the algorithm? (0S Marks) By using limits compare the order of growth of the following: () — togyn and Vn. ii) nt and 2" (05 Marks) If M(n) denotes the number of moves i'tower8 of honoi puzzle, when n disks are involved. Give a recurrence relation for M(n) aid solve the recurrence relation. (06 Marks) Define basic three asymptotie!notations with example. (06 Marka) Define with example, (Stack (ii), Graphs ii) Trees (ivy) Sets and Dictionaries. (04 Marks) ‘Write Merge Sort algorithm/and discuss its efficiency. Sort the list EX, A, M, P, L, E in alphabetical order. (08 Marks) ‘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 clement in the set 29, 4, 88, 15,9, 87, 14,1 (08 Marks) 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 T(n)=41 ifn=2 (08 Marks) 0 ifn=1 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 (di, ds,ids, ds) = (2, 1, 2, 1) Find all the feasible sohtions and optimal soln T0b Sending wih deadlines problem. ~~ (05 Marks) Write Dijikstra’s algorithm. Apply Dijikstta’s elgorithni on.the graph given in Fig. Q6 (a), to obtain the shortest paths from souree vertex | (08 Marks) Fig. Q6(8) Sort thé array 3, 2, 4, 1, 6, § by using heapsort with array representation of heaps in ineréasing order. (04 Marks) Write Kruskal’s algorithm, (04 Marks) Using Warshalls algorithm, obtain transitive closure of matrix for the graph given in Fie, Q7,), (08 Marks) @c—@ Fig, Q7 (a) Using dynamic programming solve the following knapsack instance. For n = 4, M = 5, (Wi, Wo, Way Wa) = (2, 1, 3, 2) and (Pi, Po, Ps, Pa) = (12, 10, 20, 15) (08 Marks) 20f3 8 10 15C843, 2. Write Floyd's algorithm. Find all pair shortest path for the graph given in Fig. Q8 (a). (08 Marks) Fig. Q8 (a) b. Write short note on: (Reliability design. Gi) Optimal binary search tree algorithm and its efficiency. (08 Marks) 4. Write the pseudocode for backtracking algorithm. Apply backirdeking to solve tne instance of the sum of subset problem. S = (3,5, 6, 7) and d = 15. (08 Marks) b. Write short note on: (i) N Queen's problem Gi) Hamiltonian cycles. (08 Marks) 4. With the help of a state space tree, solve the following’Salésperson problem for graph given in Fig, QI0 (a), using branch and bound algorithm, (08 Marks) b. Write short note on: ‘Non determini Graph Colouring P. NP problems NP hard class. (08 Marks) 3083

You might also like