DAA Question Bank
DAA Question Bank
DAA Question Bank
Unit I
2. Name the sorting algorithm that is most practically used and also write its Time Complexity.
T(n)= n +T(n/10)+T(7n/5)
7. Explain HEAP-SORT on the array. Illustrate the operation of HEAP-SORT on the array A= {6, 14, 3, 25,
2, 10, 20, 7, 6}
8. The recurrence T (n) =7T (n/2) +n 2 describe the running time of an algorithm A.A competing
algorithm A has a running time of T’ (n) =aT’ (n/4) +n 2 .What is the largest integer value for a A’ is
asymptotically faster than A?
9. Solve the following recurrence relations a) x(n)=x(n -1) + 5 for n > 1 x(1)=0 b) x(n)=3x(n-1) for n > 1
x(1)=4 c) x(n)=x(n-1)+n for n > 0 x(0)=0 d) x(n)=x(n/2)+n for n > 1 x(1)=1 (e) x(n)=x(n/3)+1 for n >1 x(1)=1
10. Write the asymptotic notations used for best case ,average case and worst case analysis of
algorithms and Write an algorithm for finding maximum element of an array perform best , worst and
average case complexity with appropriate order notations
11. Explain quick sort algorithm and simulate it for the following data 20,35, 10, 16, 54, 21,
13. Sort the list of numbers using merge sort: 78, 32, 42, 62, 98, 12, 34, 83.
14. Understand merge sort on letters H, K, P,C,S,K,R,A,B,L. 15. Show that the average case time
complexity of quick sort is O(nlogn)
Unit II
2. What is Red-Black tree? Write an algorithm to insert a node in an empty red-black tree explain with
suitable example.
3. Explain Convex –Hull problem.
4. Explain properties of Binomial Heap in .Write an algorithm to perform uniting two Binomial Heaps.
And also to find Minimum Key.
5. Explain the algorithm for deleting element of Binomial Heaps. And give the Example for the same.
6. Draw the complete binary tree of height 3 on the keys {1, 2, 3... 15}. Add the NIL leaves and color the
nodes in three different ways such that the black heights of the resulting trees are: 2, 3 and 4.
7. Show the red-black trees that result after successively inserting the keys 41,38,31,12,19,8 into an
initially empty red-black tree.
8. In a previous example, we found that the red-black tree that results from successively inserting the
keys 41,38,31,12,19,8 into an initially empty tree. Now show the red-black trees that result from the
successful deletion of the keys in the order 8, 12, 19,31,38,41.
Unit III
2. What is Minimum Cost Spanning Tree? Explain Kruskal’s Algorithm and Find MST of the Graph. Also
write its Time-Complexity
3. Find the shortest path in the below graph from the source vertex 1 to all other vertices by using
Dijkstra’s algorithm.
4. Given the six items in the table below and a Knapsack with Weight 100, what is the solution to the
Knapsack problem in all concepts. I.e. explain greedy all approaches and find the optimal solution 254
10. What is the largest number of key comparisons made by binary search in searching for a key in the
following array? 3,14, 27, 31, 39, 42, 55, 70, 74, 81, 85, 93, 98
13. Explain in detail quick sorting method. Provide a complete analysis of quick sort with example.
14. Explain in detail merge sort. Illustrate the algorithm with a numeric example. Provide complete
analysis of the same.
15. Write short notes on the following i. Strassen’s Matrix Multiplication ii. Multiplication of largest
integer.
Unit IV
4. What is backtracking? Discuss sum of subset problem with the help of an example.
5. Write down an algorithm to compute Longest Common Subsequence (LCS) of two given strings and
analyze its time complexity.
6. What is principle difference between dynamic programming and divide and Conquer techniques?
7. Apply Warshall’s Algorithm to find the transitive closure of the digraph defined by the following
adjacency matrix 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0
8. Describe the Warshall’s algorithm with example and analyze its efficiency
9. Explain Floyd’s Algorithm for all pair shortest path algorithm with example and analyze its efficiency.
256
10. Apply the bottom up dynamic programming algorithm to the following instance of Knapsack Problem
Item Weight Value 1 7 $42 2 3 $12 3 4 $40 4 5 $25 Capacity W=10
16. Explain subset-sum problem and discuss the possible solution strategies using backtracking.
Unit V
2. Compute the prefix function π for the pattern P= a b a c a b using KNUTH- MORRIS –PRATT Algorithm.
Also explain Naïve String Matching algorithm.
12. What do you mean by polynomial time reduction. Describe the detail of The Knuth-Morris-Pratt
(KMP) for string matching algorithm. Compute Π for the pattern 'p' below: