2023 question paper
Design & Analysis of Algorithms
28 questions
Q1a. The fractional Knapsack problem can be solved by using: - (i) Greedy method - (ii) Divide and conquer method - (iii) Dynamic programming - (iv) None of these20232m
Module 3: Greedy, Dynamic Programming and Other Paradigms
View this question on its own page →The fractional Knapsack problem can be solved by using:
- (i) Greedy method
- (ii) Divide and conquer method
- (iii) Dynamic programming
- (iv) None of these
Q1b. BFS on a graph G=(V,E) has running time: - (i) O(|V|+|E|) - (ii) O(|V|) - (iii) O(|E|) - (iv) None of the above20232m
Module 4: Graph and Tree Algorithms
View this question on its own page →BFS on a graph has running time:
- (i)
- (ii)
- (iii)
- (iv) None of the above
Worked SolutionAnswer
Correct Option: (i)
Explanation
Breadth-First Search (BFS) using adjacency list:
Complexity Analysis
- Initialization: — mark all vertices unvisited, enqueue source.
- Each vertex is enqueued and dequeued exactly once → .
- Each edge is examined twice (once from each endpoint in undirected graph, once in directed) when exploring adjacency list of its source vertex → .
Total:
Why other options are wrong
- (ii) : Ignores edge scanning. Correct only if graph is empty ().
- (iii) : Ignores vertex initialization and isolated vertices.
- Adjacency matrix BFS would be , but with adjacency list (standard) it is .
Final Answer
BFS running time is → Option (i).
Q1c. The minimum number of colors needed to color a graph having n > 3 vertices and 2 edges is: - (i) 2 - (ii) 3 - (iii) 4 - (iv) 120232m
Module 4: Graph and Tree Algorithms
View this question on its own page →The minimum number of colors needed to color a graph having vertices and 2 edges is:
- (i) 2
- (ii) 3
- (iii) 4
- (iv) 1
Q1g. Level order traversal of a rooted tree can be done by starting from root and performing: - (i) Depth first search - (ii) Breadth first search - (iii) Pre-order traversal - (iv) In-order traversal20232m
Module 4: Graph and Tree Algorithms
View this question on its own page →Level order traversal of a rooted tree can be done by starting from root and performing:
- (i) Depth first search
- (ii) Breadth first search
- (iii) Pre-order traversal
- (iv) In-order traversal
Q1h. An algorithm is made up of two independent time complexities f(n) and g(n). Then the complexity of the algorithm is in order of: - (i) f(n) \times g(n) - (ii) \max(f(n), g(n)) - (iii) \min(f(n), g(n)) - (iv) f(n) + g(n)20232m
Module 1: Introduction and Complexity Analysis
View this question on its own page →An algorithm is made up of two independent time complexities and . Then the complexity of the algorithm is in order of:
- (i)
- (ii)
- (iii)
- (iv)
Q1i. Which of the following standard algorithms is not a greedy algorithm? - (i) Dijkstra's shortest path algorithm - (ii) Kruskal algorithm - (iii) Bellman ford shortest path algorithm - (iv) Prim's algorithm20232m
Module 3: Greedy, Dynamic Programming and Other Paradigms
View this question on its own page →Which of the following standard algorithms is not a greedy algorithm?
- (i) Dijkstra's shortest path algorithm
- (ii) Kruskal algorithm
- (iii) Bellman ford shortest path algorithm
- (iv) Prim's algorithm
Q1j. The node removal of which makes a graph disconnected is called: - (i) Pendant vertex - (ii) Bridge - (iii) Articulation point - (iv) Coloured vertex20232m
Module 4: Graph and Tree Algorithms
View this question on its own page →The node removal of which makes a graph disconnected is called:
- (i) Pendant vertex
- (ii) Bridge
- (iii) Articulation point
- (iv) Coloured vertex
Q2a. Discuss the average, worst, and best time complexity of the algorithm. Give suitable examples.20237m
Module 1: Introduction and Complexity Analysis
View this question on its own page →Discuss the average, worst, and best time complexity of the algorithm. Give suitable examples.
Q2b. Write the algorithm for quick-sort and find its complexity.20237m
Module 2: Divide and Conquer Paradigm and Heaps
View this question on its own page →Write the algorithm for quick-sort and find its complexity.
Q3a. Construct the Huffman coding tree for the text of characters with given frequencies. | Character | T | I | V | K | L | E | O | Z | P | R | |----------:|:--:|:--:|:--:|:-:|:--:|:--:|:--:|:--:|:--:|:--:| | Frequency | 43 | 38 | 16 | 8 | 56 | 12 | 41 | 13 | 22 | 6 |20237m
Module 3: Greedy, Dynamic Programming and Other Paradigms
View this question on its own page →Construct the Huffman coding tree for the text of characters with given frequencies.
Character T I V K L E O Z P R Frequency 43 38 16 8 56 12 41 13 22 6 - Install PocketlyBudget App•POCKETLY
Pocketly on Android
Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.
Q3b. State the general Knapsack problem. Write a greedy algorithm for this problem and derive its time complexity.20237m
Module 3: Greedy, Dynamic Programming and Other Paradigms
View this question on its own page →State the general Knapsack problem. Write a greedy algorithm for this problem and derive its time complexity.
Q4a. State Master's theorem and find the time complexity for the following recurrence: T(n) = 2T(n^{1/2}) + \log n20237m
Module 1: Introduction and Complexity Analysis
View this question on its own page →State Master's theorem and find the time complexity for the following recurrence:
Q4b. What is negative weight-cycle? Write Bellman-Ford algorithm to find single shortest distance of a directed graph.20237m
Module 4: Graph and Tree Algorithms
View this question on its own page →What is negative weight-cycle? Write Bellman-Ford algorithm to find single shortest distance of a directed graph.
Q5a. Find the minimum number of operations required for the following matrix chain multiplication using dynamic programming: A(10 \times 20) * B(20 \times 50) * C(50 \times 1) * D(1 \times 100)20237m
Module 3: Greedy, Dynamic Programming and Other Paradigms
View this question on its own page →Find the minimum number of operations required for the following matrix chain multiplication using dynamic programming:
Q5b. Write Knuth-Morris-Pratt (KMP) algorithm for string matching problem.20237m
Module 3: Greedy, Dynamic Programming and Other Paradigms
View this question on its own page →Write Knuth-Morris-Pratt (KMP) algorithm for string matching problem.
Q6a. Write an algorithm to find a minimum spanning tree (MST) for an undirected graph. Estimate the time complexity of your algorithm.20238m
Module 3: Greedy, Dynamic Programming and Other Paradigms
View this question on its own page →Write an algorithm to find a minimum spanning tree (MST) for an undirected graph. Estimate the time complexity of your algorithm.
Q6b. Using greedy strategy, schedule the following jobs within deadline so as to maximize the profit. | Job i | 1 | 2 | 3 | 4 | | :--- | :--- | :--- | :--- | :--- | | Deadline d | 3 | 2 | 3 | 1 | | Profit g | 9 | 7 | 7 | 2 |20236m
Module 3: Greedy, Dynamic Programming and Other Paradigms
View this question on its own page →Using greedy strategy, schedule the following jobs within deadline so as to maximize the profit.
Job 1 2 3 4 Deadline 3 2 3 1 Profit 9 7 7 2 Q7a. Write an algorithm for n-queen's problem, find its time complexity and explain the algorithm using an example.20237m
Module 3: Greedy, Dynamic Programming and Other Paradigms
View this question on its own page →Write an algorithm for -queen's problem, find its time complexity and explain the algorithm using an example.
Q7b. Solve the single source shortest path problem for the following graph considering '1' as the source vertex using Dijkstra's algorithm. (Graph image reference in source document)20237m
Module 4: Graph and Tree Algorithms
View this question on its own page →Solve the single source shortest path problem for the following graph considering '1' as the source vertex using Dijkstra's algorithm. (Graph image reference in source document)
Q8a. Define the classes P and NP.20232m
Module 5: Tractable and Intractable Problems
View this question on its own page →Define the classes and .
- Install PocketlyBudget App•POCKETLY
Pocketly on Android
Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.
Q8b. Discuss what you mean by polynomial reduction.20232m
Module 5: Tractable and Intractable Problems
View this question on its own page →Discuss what you mean by polynomial reduction.
Q8c. Discuss diagrammatically the relation among P class, NP class, NP hard and NP complete.20232m
Module 5: Tractable and Intractable Problems
View this question on its own page →Discuss diagrammatically the relation among class, class, hard and complete.
Q8d. Describe Clique Decision Problem (CDP).20232m
Module 5: Tractable and Intractable Problems
View this question on its own page →Describe Clique Decision Problem (CDP).
Q8e. Explain the max-flow min-cut theorem with an example.20236m
Module 4: Graph and Tree Algorithms
View this question on its own page →Explain the max-flow min-cut theorem with an example.
Q9a. Write short notes on: Asymptotic notations20237m
Module 1: Introduction and Complexity Analysis
View this question on its own page →Write short notes on: Asymptotic notations
Q9b. Write short notes on: Heap creation technique20237m
Module 2: Divide and Conquer Paradigm and Heaps
View this question on its own page →Write short notes on: Heap creation technique
Q9c. Write short notes on: Strassen's matrix multiplication20237m
Module 2: Divide and Conquer Paradigm and Heaps
View this question on its own page →Write short notes on: Strassen's matrix multiplication
Q9d. Write short notes on: Divide-and-Conquer vs Dynamic programming20237m
Module 3: Greedy, Dynamic Programming and Other Paradigms
View this question on its own page →Write short notes on: Divide-and-Conquer vs Dynamic programming
PYQDeck for Android
Solve BEU previous-year exam papers anywhere, anytime. Fast search, offline paper viewing, and step-by-step solutions designed specifically for your phone.