Design and Analysis of Algorithms
Design and Analysis of Algorithms
3. Solve recurrence relations of following algorithms for best and worst case.
1) Binary search 2) Quick Sort 3) Merge Sort.
4. Discuss working and worst case of quicksort. How to improve worst case of quicksort?
5. Define counting inversion. Find counting inversions in given array: 5, 33,25,4,11,22,78,1,98 using
divide and conquer technique.
6. Find the minimum spanning tree (MST) using Kruskal and Prim’s algorithm from following graph.
Also draw the MST obtained using Kruskal and Prim’s algorithm.
9. Solve fractional knapsack problem given as below using Greedy with v is value and w is weight of
each item whereas M is knapsack capacity. M=60.
N N1 N2 N3 N4
vi 280 100 120 120
wi 40 10 20 24
10. Apply minimum finish time first, minimum start time first and minimum interval first strategy on
following intervals. Which method will return optimal answer?
[1,10) ,[5,7) ,[2,3),[0,5),[3,5),[8,9),[4,6),[7,9)
11. Write an algorithm for making change problem using dynamic programming. Apply dynamic
programming algorithm to construct table for change of amount 14 with coins of denomination 1,
5, 7 and 10.
12. For the following matrices find the order of parenthesization for the optimal chained multiplication
using dynamic programming.
Matrices: A1: 10 x 3, A2: 3 x 20, A3: 20 x 50, A4: 50 x 30
13. Which kind of problems can be solved with Dynamic programming? What is Memoization? Write
algorithm of calculating Binomial coefficients using memoization and dynamic approach.
14. Consider 0/1 knapsack problem as below with w indicates the weight and v indicates the value of
each item respectively, whereas M denotes knapsack capacity. There are total 4 items. Construct
the table and find optimal answer using dynamic programming technique.
M=5 w=[2 3 4 5 ] v=[3 4 5 6 ]
15. Discuss branch and bound technique. Solve following assignment problem with branch and bound
problem.