Download as pdf
Download as pdf
You are on page 1of 3
Roll / Exan No. ‘Time 3 Hours Nirma University Institute of Technology Semester End Examination (I), May = 2023 Mater of Computer pponson Sea ‘SCS1S1 Deuien and Rnali f Aigritons Supervisor's initial with date Instructions: 1. Attempt all questions 4. ro) coa BL. ) Coa BLa e2. “ con, BL2 @) C02, BLS c col, 3 BLS 2, Figures tothe right indicate full marks, 3, Use a section-wise separate answer book 4. Draw neat sketches wherever necessary. 5. Assume suitable data wherever necessary. 6. Use of a scientific calculator is allowed. SECTION -1 Do as directed. Explains whay Whe anys of algorithms ts important. Explain Best case, ‘worst case, and average case complexity with suitable examples, Arrange the following rate of growth of algorithms in increasing order, n,n, 25, n2, n Jog n, log n, 1, 29, log n Solve the following equations with the appropriate method. 1. ag = ay ~ daa where do = 4-and at 12 2. Tio) = 2 Tin/2} +m with n > O and n is power of two, Til) = 1 and 72)-3 Do as directed. Wirite Kruskal’s algorithm to find the minimum cost-spanning tree. Also, discuss the time complexity for the same. Apply Binary Search and Linear search on the following data to search clement 45, 10 14 19 29 38 45 48 58 60 Derive the time complexity of linear search and binary search for the We have a'set ofn jobs to execute, each of which takes a tnit of time, At any time T = 1,2,.., we can execute exactly one job. A jab earns us a profit Pi > 0 if and only if executed not Inter than time di (deadline), Apply a greedy algorithm to schedule the job for the following data such that it gives maximum profit. Jobs] 2 3 a Profit [50 10, 15 30 Deadline [2 4 3 7 Paget Max Marks: 100 16) © @ 118) © 6 6) 2s (ay coe BLS e co 3 BLA e cos BL Qs. ) col, BL 6CS151 DESIGN AND ANALYSIS OF ALGORITHM Do as directed. Design the Merge sort algorithm using the divide and conquer technique. Trace the following data to sort using Merge sort. Give the pros and cons of using Merge sort ‘58 59 23 17 46 92 19 54 Explain and write Floyd's algorithm to find the shortest path for all pairs of vertex for a graph. Show step-by-step tracing for the algorithm to find the shortest path in the following graph, Assume the initial vertex as ‘I’ srction — 1 Do as directed. Explain about Hamiltonian Cycle in a Graph. Show step-by-step tracing to find out the Hamiltonian cycle using a backtracking approach for the below-mentioned graph ir starting node is‘ ‘The N Queen is a problem of placing N chess queens on + NxN chess board so that no tho queens attack each other. Apply Backtracking for the N Queen problem for the value of Nas 4. Shew the step-by-step solution, Do as directed. Explain the optimization problem. Through which techniques can optimization problems be solved? Compare and contrast all those techniques. 6] 6) 6) 6} Cc) 6) 118) @ ° col BLS © C03, BLS eo. “ cos Bis @ cos BLS 6CS1S1 DESIGN AND ANALYSIS OF ALGORITHM Find the optimal order of multiplying the following matrices using aynamic programming. The Resultant matrix Z ~ ABCDE. Dimensions of individual matrices A, B, C, D, B are as under. A:2X5-B:SX9.-C:9X9_D: 9X15 Es 15X3 Using Branch and Bound algorithm to find the optimal solution for 0/1 Knapsack problem where n=4, W=15, (pl, p2, p3, p4) = (10, 10, 12, 18) and (wl, w2, w3, w4) = (2, 4, 6, 9) Do as directed. Using dynamic programming, find the Longest Common Subsequence of given sequences P and Q. Bw and Q = . Write an algorithm for the same, State making coin change problem. Given coins of denomination 1, 2, land 5 with the amount to be paid 9. Find the optimal number of coins ‘along with the denomination of coins required to pay using dynamic programming, Also, write a dynamic programming algorithm to solve ‘making coin change problems, o 0) 16) 8) Co)

You might also like