2019 question paper
Design & Analysis of Algorithms
23 questions
Q1a. In the following C++ function, let n >= m. ``cpp 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; } `` What is the time complexity of the above function assuming n > m? - (i) \Theta(\log n) - (ii) \Omega(n) - (iii) \Theta(\log \log n) - (iv) \Theta(\sqrt{n})20192m
Module 1: Introduction and Complexity Analysis
View this question on its own page →In the following C++ function, let .
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; }What is the time complexity of the above function assuming ?
- (i)
- (ii)
- (iii)
- (iv)
Q1b. Time complexity of Kadane's Algorithm is: - (i) O(n) - (ii) O(n^2) - (iii) O(n \log n) - (iv) O(n(\log n)^2)20192m
Module 3: Greedy, Dynamic Programming and Other Paradigms
View this question on its own page →Time complexity of Kadane's Algorithm is:
- (i)
- (ii)
- (iii)
- (iv)
Q1c. 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? - (i) 1/8 - (ii) 1 - (iii) 8 - (iv) 820192m
Module 4: Graph and Tree Algorithms
View this question on its own page →Consider an undirected random graph of eight vertices. The probability that there is an edge between a pair of vertices is . What is the expected number of unordered cycles of length three?
- (i) 1/8
- (ii) 1
- (iii) 8
- (iv) 8
Q1d. Any decision tree that sorts n elements has height: - (i) \Omega(\lg n) - (ii) \Omega(n) - (iii) \Omega(n \lg n) - (iv) \Omega(n^2)20192m
Module 1: Introduction and Complexity Analysis
View this question on its own page →Any decision tree that sorts elements has height:
- (i)
- (ii)
- (iii)
- (iv)
Q1e. An all-pairs shortest-paths problem is efficiently solved using: - (i) Dijkstra's algorithm - (ii) Bellman-Ford algorithm - (iii) Kruskal algorithm - (iv) Floyd-Warshall algorithm20192m
Module 3: Greedy, Dynamic Programming and Other Paradigms
View this question on its own page →An all-pairs shortest-paths problem is efficiently solved using:
- (i) Dijkstra's algorithm
- (ii) Bellman-Ford algorithm
- (iii) Kruskal algorithm
- (iv) Floyd-Warshall algorithm
Q1f. Which of the following is an advantage of adjacency list representation over adjacency matrix representation of a graph? - (i) In adjacency list representation, space is saved for sparse graphs. - (ii) DFS and BFS can be done in O(V+E) time for adjacency list representation. These operations take O(V^2) time in adjacency matrix representation. - (iii) Adding a vertex in adjacency list representation is easier than adjacency matrix representation. - (iv) All of the above20192m
Module 4: Graph and Tree Algorithms
View this question on its own page →Which of the following is an advantage of adjacency list representation over adjacency matrix representation of a graph?
- (i) In adjacency list representation, space is saved for sparse graphs.
- (ii) DFS and BFS can be done in time for adjacency list representation. These operations take time in adjacency matrix representation.
- (iii) Adding a vertex in adjacency list representation is easier than adjacency matrix representation.
- (iv) All of the above
Q1g. Which of the following is true about Huffman Coding? - (i) Huffman coding may become lossy in some cases. - (ii) Huffman codes may not be optimal lossless codes in some cases. - (iii) In Huffman coding, no code is prefix of any other code. - (iv) All of the above20192m
Module 3: Greedy, Dynamic Programming and Other Paradigms
View this question on its own page →Which of the following is true about Huffman Coding?
- (i) Huffman coding may become lossy in some cases.
- (ii) Huffman codes may not be optimal lossless codes in some cases.
- (iii) In Huffman coding, no code is prefix of any other code.
- (iv) All of the above
Q1h. Which one of the following is an application of Queue Data Structure? - (i) When a resource is shared among multiple consumers - (ii) When data is transferred asynchronously (data not necessarily received at same rate as sent) between two processes - (iii) Load balancing - (iv) All of the above20192m
Module 1: Introduction and Complexity Analysis
View this question on its own page →Which one of the following is an application of Queue Data Structure?
- (i) When a resource is shared among multiple consumers
- (ii) When data is transferred asynchronously (data not necessarily received at same rate as sent) between two processes
- (iii) Load balancing
- (iv) All of the above
Q1j. The complexity of binary search algorithm is: - (i) O(n) - (ii) O(\log n) - (iii) O(n^2) - (iv) O(n \log n)20192m
Module 2: Divide and Conquer Paradigm and Heaps
View this question on its own page →The complexity of binary search algorithm is:
- (i)
- (ii)
- (iii)
- (iv)
Q2a. Discuss the steps in mathematical analysis for recursive algorithm. Do the same for finding the factorial of a number?20197m
Module 1: Introduction and Complexity Analysis
View this question on its own page →Discuss the steps in mathematical analysis for recursive algorithm. Do the same for finding the factorial of a number?
Q2b. What are the rules of manipulate Big-Oh expression? Write about the typical growth rates of algorithms.20197m
Module 1: Introduction and Complexity Analysis
View this question on its own page →What are the rules of manipulate Big-Oh expression? Write about the typical growth rates of algorithms.
Q3a. What are the advantages of merge-sort over the quick-sort algorithm?20197m
Module 2: Divide and Conquer Paradigm and Heaps
View this question on its own page →What are the advantages of merge-sort over the quick-sort algorithm?
Q3b. What is the time complexity of the matrix multiplication and Strassen's algorithm?20197m
Module 2: Divide and Conquer Paradigm and Heaps
View this question on its own page →What is the time complexity of the matrix multiplication and Strassen's algorithm?
Q4. 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)).201914m
Module 1: Introduction and Complexity Analysis
View this question on its own page →Prove that if and , then .
Q5a. What is the relationship among P, NP and NP complete problems? Show with the help of a diagram.20197m
Module 5: Tractable and Intractable Problems
View this question on its own page →What is the relationship among P, NP and NP complete problems? Show with the help of a diagram.
Q5b. Compare the various programming paradigms such as divide-and-conquer, dynamic programming and greedy approach.20197m
Module 3: Greedy, Dynamic Programming and Other Paradigms
View this question on its own page →Compare the various programming paradigms such as divide-and-conquer, dynamic programming and greedy approach.
Q6. 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 attribute its size of node. Retrieve 17th smallest element in the tree and rank the 12th element.201914m
Module 4: Graph and Tree Algorithms
View this question on its own page →Consider the array . Create binary search tree with one more attribute its size of node. Retrieve 17th smallest element in the tree and rank the 12th element.
Q7. What do you mean by optimal solution in greedy approach? Define the properties and function of greedy approach. Consider the graph G = (V, E) given below. Find the minimum spanning tree by Prim's algorithms. 201914m
Module 3: Greedy, Dynamic Programming and Other Paradigms
View this question on its own page →What do you mean by optimal solution in greedy approach? Define the properties and function of greedy approach. Consider the graph given below. Find the minimum spanning tree by Prim's algorithms.

Q8. 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 following graph using state space tree. Assume three colours red, green and blue. 201914m
Module 5: Tractable and Intractable Problems
View this question on its own page →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 following graph using state space tree. Assume three colours red, green and blue.

Q9a. Write short notes on: Kruskal algorithms.20197m
Module 3: Greedy, Dynamic Programming and Other Paradigms
View this question on its own page →Write short notes on: Kruskal algorithms.
Q9b. Write short notes on: Branch and bound technique20197m
Module 5: Tractable and Intractable Problems
View this question on its own page →Write short notes on: Branch and bound technique
Q9c. Write short notes on: Amortized analysis.20197m
Module 1: Introduction and Complexity Analysis
View this question on its own page →Write short notes on: Amortized analysis.
Q9d. Write short notes on: Divide-N-Conquer vs Dynamic Programming20197m
Module 3: Greedy, Dynamic Programming and Other Paradigms
View this question on its own page →Write short notes on: Divide-N-Conquer vs Dynamic Programming