Design and Analysis of Algorithms - B.Tech 5th Semester Exam., 2019
Design and Analysis of Algorithms
Instructions:
- The marks are indicated in the right-hand margin.
- There are NINE questions in this paper.
- Attempt FIVE questions in all.
- Question No. 1 is compulsory.
-
In the following C++ function, let \( n \ge m \). What is the time complexity of the above function assuming \( n > m \)?
int gcd(int n, int m) { if(n%m==0) return m; if(n < m) swap(n, m); while(m>0) { n=n%m; swap(n, m); } return n; } -
Time complexity of Kadane's Algorithm is
-
Consider an undirected random graph of eight vertices. The probability that there is an edge between a pair of vertices is 1/2. What is the expected number of unordered cycles of length three?
-
Any decision tree that sorts 'n' elements has height
-
An all-pairs shortest-paths problem is efficiently solved using
-
Which of the following is an advantage of adjacency list representation over adjacency matrix representation of a graph?
-
Which of the following is true about Huffman Coding?
-
Which one of the following is an application of Queue Data Structure?
-
In linear search algorithm the worst case occurs when
-
The complexity of binary search algorithm is
-
Discuss the steps in mathematical analysis for recursive algorithm. Do the same for finding the factorial of a number?
-
What are the rules of manipulate Big-Oh expression? Write about the typical growth rates of algorithms.
-
What are the advantages of merge-sort over the quick-sort algorithm?
-
What is the time complexity of the matrix multiplication and Strassen's algorithm?
-
Prove that if \( f_1(n) = O(g_1(n)) \) and \( f_2(n) = O(g_2(n)) \), then \( f_1(n)+f_2(n) = O(g_1(n)+g_2(n)) \).
-
What is the relationship among P, NP and NP complete problems? Show with the help of a diagram.
-
Compare the various programming paradigms such as divide-and-conquer, dynamic programming and greedy approach.
-
Consider the array A = {26, 17, 41, 14, 21, 30, 47, 10, 16, 19, 21, 28, 38, 7, 12, 14, 20, 35, 39, 3}. Create binary search tree with one more attributes its size of node. Retrieve 17th smallest element in the tree and rank the 12th element.
-
What do you mean by optimal solution in greedy approach? Define the properties and function of greedy approach. Consider a graph \( G=(V,E) \) and find the minimum spanning tree by Prim's algorithms.
-
Explain back-tracking, DFS and BFS with help of small example. Differentiate in between backtracking and dynamic programming. Apply the backtracking algorithm to solve the three-colouring problem for the graph using state space tree. Assume three colours red, green and blue.