2024 question paper

Design and Analysis of Algorithms

26 questions

  1. Q1a. Which of the following best describes space complexity? (i) Time taken by the algorithm (ii) Memory required to run an algorithm (iii) Number of recursive calls (iv) Number of loops used20242m

    Module 1: Introduction

    Which of the following best describes space complexity?
    (i) Time taken by the algorithm
    (ii) Memory required to run an algorithm
    (iii) Number of recursive calls
    (iv) Number of loops used

    View this question on its own page →
  2. Q1b. If an algorithm has time complexity T(n) = 5n^2 + 3n + 7, its asymptotic upper bound is: (i) O(n) (ii) O(n^2) (iii) O(n \log n) (iv) O(n^3)20242m

    Module 1: Introduction

    If an algorithm has time complexity T(n)=5n2+3n+7T(n) = 5n^2 + 3n + 7, its asymptotic upper bound is:
    (i) O(n)O(n)
    (ii) O(n2)O(n^2)
    (iii) O(nlogn)O(n \log n)
    (iv) O(n3)O(n^3)

    View this question on its own page →
  3. Q1c. The recurrence T(n) = T(n/2) + 1 has a time complexity of: (i) O(n) (ii) O(\log n) (iii) O(n \log n) (iv) O(n^2)20242m

    Module 1: Introduction

    The recurrence T(n)=T(n/2)+1T(n) = T(n/2) + 1 has a time complexity of:
    (i) O(n)O(n)
    (ii) O(logn)O(\log n)
    (iii) O(nlogn)O(n \log n)
    (iv) O(n2)O(n^2)

    View this question on its own page →
  4. Q1d. Which strategy solves problems by solving subproblems and combining their solutions? (i) Brute Force (ii) Greedy (iii) Dynamic Programming (iv) Backtracking20242m

    Module 2: Fundamental Algorithmic Strategies

    Which strategy solves problems by solving subproblems and combining their solutions?
    (i) Brute Force
    (ii) Greedy
    (iii) Dynamic Programming
    (iv) Backtracking

    View this question on its own page →
  5. Q1e. In DFS traversal of a graph, which data structure is used to keep track of visited nodes? (i) Queue (ii) Stack (iii) Priority Queue (iv) Heap20242m

    Module 3: Graph and Tree Algorithms

    In DFS traversal of a graph, which data structure is used to keep track of visited nodes?
    (i) Queue
    (ii) Stack
    (iii) Priority Queue
    (iv) Heap

    View this question on its own page →
  6. Q1f. Which algorithm is used to find a Minimum Spanning Tree? (i) Dijkstra's algorithm (ii) Prim's algorithm (iii) Bellman-Ford algorithm (iv) Floyd-Warshall algorithm20242m

    Module 3: Graph and Tree Algorithms

    Which algorithm is used to find a Minimum Spanning Tree?
    (i) Dijkstra's algorithm
    (ii) Prim's algorithm
    (iii) Bellman-Ford algorithm
    (iv) Floyd-Warshall algorithm

    View this question on its own page →
  7. Q1g. Topological sorting is only possible in: (i) Undirected Graphs (ii) Trees (iii) Directed Acyclic Graphs (iv) Weighted Graphs20242m

    Module 3: Graph and Tree Algorithms

    Topological sorting is only possible in:
    (i) Undirected Graphs
    (ii) Trees
    (iii) Directed Acyclic Graphs
    (iv) Weighted Graphs

    View this question on its own page →
  8. Q1h. Which algorithm is typically used in maximum flow problems? (i) Kruskal's Algorithm (ii) Floyd-Warshall (iii) Ford-Fulkerson (iv) Prim's Algorithm20242m

    Module 3: Graph and Tree Algorithms

    Which algorithm is typically used in maximum flow problems?
    (i) Kruskal's Algorithm
    (ii) Floyd-Warshall
    (iii) Ford-Fulkerson
    (iv) Prim's Algorithm

    View this question on its own page →
  9. Q1i. What is the primary technique used to prove that a problem is NP-complete? (i) Divide and conquer (ii) Dynamic programming (iii) Polynomial-time reduction from a known NP-complete problem (iv) Space complexity calculation20242m

    Module 4: Tractable and Intractable Problems

    What is the primary technique used to prove that a problem is NP-complete?
    (i) Divide and conquer
    (ii) Dynamic programming
    (iii) Polynomial-time reduction from a known NP-complete problem
    (iv) Space complexity calculation

    View this question on its own page →
  10. Q1j. Randomized algorithms make use of: (i) Deterministic input (ii) Random choices during execution (iii) Recursive backtracking (iv) Fixed input-output pairs20242m

    Module 5: Advanced Topics

    Randomized algorithms make use of:
    (i) Deterministic input
    (ii) Random choices during execution
    (iii) Recursive backtracking
    (iv) Fixed input-output pairs

    View this question on its own page →
  11. Q2a. Answer the following: (i) Differentiate between best-case, worst-case, and average-case complexity with suitable examples. (ii) Use examples like linear search to demonstrate the differences. (iii) Discuss why worst-case analysis is often preferred in practice.20247m

    Module 1: Introduction

    Answer the following:
    (i) Differentiate between best-case, worst-case, and average-case complexity with suitable examples.
    (ii) Use examples like linear search to demonstrate the differences.
    (iii) Discuss why worst-case analysis is often preferred in practice.

    View this question on its own page →
  12. Q2b. Suppose the number of basic operations in an algorithm is defined as: T(n) = T(n-1) + n, with T(1) = 1. Solve this recurrence using the substitution method and determine the time complexity.20247m

    Module 1: Introduction

    Suppose the number of basic operations in an algorithm is defined as: T(n)=T(n1)+nT(n) = T(n-1) + n, with T(1)=1T(1) = 1.
    Solve this recurrence using the substitution method and determine the time complexity.

    View this question on its own page →
  13. Q3a. What is the Master's Theorem? State the general form and the three cases of the theorem. Use it to solve the following recurrence relations: (i) T(n) = 2T(n/2) + n (ii) T(n) = 3T(n/2) + n^2 (iii) T(n) = 2T(n/2) + n/\log n Explain which case applies in each situation.20247m

    Module 1: Introduction

    What is the Master's Theorem? State the general form and the three cases of the theorem. Use it to solve the following recurrence relations:
    (i) T(n)=2T(n/2)+nT(n) = 2T(n/2) + n
    (ii) T(n)=3T(n/2)+n2T(n) = 3T(n/2) + n^2
    (iii) T(n)=2T(n/2)+n/lognT(n) = 2T(n/2) + n/\log n
    Explain which case applies in each situation.

    View this question on its own page →
  14. Q3b. Answer the following: (i) Compare dynamic programming and greedy algorithms in terms of their problem-solving approaches, solution spaces, and efficiency. (ii) Discuss scenarios where dynamic programming is necessary because greedy strategies fail. Use suitable problem examples to support your explanation. (iii) Explain how overlapping subproblems and optimal substructure are utilized in dynamic programming.20247m

    Module 2: Fundamental Algorithmic Strategies

    Answer the following:
    (i) Compare dynamic programming and greedy algorithms in terms of their problem-solving approaches, solution spaces, and efficiency.
    (ii) Discuss scenarios where dynamic programming is necessary because greedy strategies fail. Use suitable problem examples to support your explanation.
    (iii) Explain how overlapping subproblems and optimal substructure are utilized in dynamic programming.

    View this question on its own page →
  15. Q4a. The 0/1 Knapsack Problem is a classical combinatorial optimization problem. Explain how this problem can be solved using: (i) Brute-force method (ii) Greedy method (iii) Dynamic Programming (iv) Branch-and-Bound For each approach, explain the algorithm, time complexity, and limitations. Highlight why the greedy method may not always yield the optimal solution.20247m

    Module 2: Fundamental Algorithmic Strategies

    The 0/1 Knapsack Problem is a classical combinatorial optimization problem. Explain how this problem can be solved using:
    (i) Brute-force method
    (ii) Greedy method
    (iii) Dynamic Programming
    (iv) Branch-and-Bound
    For each approach, explain the algorithm, time complexity, and limitations. Highlight why the greedy method may not always yield the optimal solution.

    View this question on its own page →
  16. Q4b. Consider a TSP with 4 cities A, B, C, D and the following distance matrix: | | A | B | C | D | |---|---|---|---|---| | A | 0 | 10 | 15 | 20 | | B | 10 | 0 | 35 | 25 | | C | 15 | 35 | 0 | 30 | | D | 20 | 25 | 30 | 0 | Answer the following: (i) Use the branch-and-bound algorithm to find the shortest possible route that visits all cities exactly once and returns to the starting city. (ii) Show the branching steps and calculate lower bounds for each partial solution. (iii) Identify how the bounding helps prune the search tree.20247m

    Module 2: Fundamental Algorithmic Strategies

    Consider a TSP with 4 cities A, B, C, D and the following distance matrix:

    A B C D
    A 0 10 15 20
    B 10 0 35 25
    C 15 35 0 30
    D 20 25 30 0

    Answer the following:
    (i) Use the branch-and-bound algorithm to find the shortest possible route that visits all cities exactly once and returns to the starting city.
    (ii) Show the branching steps and calculate lower bounds for each partial solution.
    (iii) Identify how the bounding helps prune the search tree.

    View this question on its own page →
  17. Q5a. Answer the following: (i) Compare and contrast the BFS and DFS traversal techniques in terms of their algorithmic approach, time complexity, data structures used, and typical applications. (ii) Give examples where one is preferred over the other.20247m

    Module 3: Graph and Tree Algorithms

    Answer the following:
    (i) Compare and contrast the BFS and DFS traversal techniques in terms of their algorithmic approach, time complexity, data structures used, and typical applications.
    (ii) Give examples where one is preferred over the other.

    View this question on its own page →
  18. Q5b. Design a system that finds the shortest paths between various locations in a city. The locations and roads are represented using a graph. What algorithm would you use if: (i) All roads have equal length (ii) Roads have varying lengths, but no negative lengths (iii) Some roads have negative lengths Justify your choices with suitable algorithms and reasoning.20247m

    Module 3: Graph and Tree Algorithms

    Design a system that finds the shortest paths between various locations in a city. The locations and roads are represented using a graph. What algorithm would you use if:
    (i) All roads have equal length
    (ii) Roads have varying lengths, but no negative lengths
    (iii) Some roads have negative lengths
    Justify your choices with suitable algorithms and reasoning.

    View this question on its own page →
  19. Q6a. A graph with five nodes is represented using the adjacency list as follows: | | | | | | |---|---|---|---|---| | A | -> | B (10) | C (3) | | | B | -> | C (1) | D (5) | | | C | -> | B (4) | D (8) | E (2) | | D | -> | E (7) | | | | E | -> | D (9) | | | Answer the following: (i) Draw the graph for the above adjacency list. (ii) Write the algorithm for the Breadth-First Traversal (BFS). (iii) Show the BFS traversal of the graph with the starting node as A.20247m

    Module 3: Graph and Tree Algorithms

    A graph with five nodes is represented using the adjacency list as follows:

    A -> B (10) C (3)
    B -> C (1) D (5)
    C -> B (4) D (8) E (2)
    D -> E (7)
    E -> D (9)

    Answer the following:
    (i) Draw the graph for the above adjacency list.
    (ii) Write the algorithm for the Breadth-First Traversal (BFS).
    (iii) Show the BFS traversal of the graph with the starting node as A.

    View this question on its own page →
  20. Q6b. Write the Pseudo-code for the Dijkstra's Algorithm. Further, find the single source (A) shortest path on the following graph: ![image](https://9lrt4yspyx.ufs.sh/f/z1z03jdN1p04c1Or1kxVDrIj0ikyQ82dzRXKGqChPbOmcuBt)20247m

    Module 3: Graph and Tree Algorithms

    Write the Pseudo-code for the Dijkstra's Algorithm. Further, find the single source (A) shortest path on the following graph:

    image

    View this question on its own page →
  21. Q7a. Answer the following: (i) Explain the concept of a Minimum Spanning Tree (MST) in a connected, weighted, undirected graph. (ii) Compare and contrast Prim's and Kruskal's algorithms for finding the MST. (iii) Analyze the time complexity of both algorithms and discuss their advantages and scenarios where one is preferred over the other.20247m

    Module 3: Graph and Tree Algorithms

    Answer the following:
    (i) Explain the concept of a Minimum Spanning Tree (MST) in a connected, weighted, undirected graph.
    (ii) Compare and contrast Prim's and Kruskal's algorithms for finding the MST.
    (iii) Analyze the time complexity of both algorithms and discuss their advantages and scenarios where one is preferred over the other.

    View this question on its own page →
  22. Q7b. Given the flow network below with capacities: | EDGE | CAPACITY | |---|---| | S -> A | 10 | | S -> C | 10 | | A -> B | 4 | | A -> C | 2 | | C -> D | 9 | | B -> T | 10 | | D -> B | 6 | | D -> T | 10 | Answer the following: (i) Use the Ford-Fulkerson algorithm to find the maximum flow from source (S) to sink (T). (ii) Show the augmenting paths selected, the bottleneck capacities on each path, and the updated residual capacities after each augmentation. (iii) Calculate the final maximum flow value.20247m

    Module 3: Graph and Tree Algorithms

    Given the flow network below with capacities:

    EDGE CAPACITY
    S -> A 10
    S -> C 10
    A -> B 4
    A -> C 2
    C -> D 9
    B -> T 10
    D -> B 6
    D -> T 10

    Answer the following:
    (i) Use the Ford-Fulkerson algorithm to find the maximum flow from source (S) to sink (T).
    (ii) Show the augmenting paths selected, the bottleneck capacities on each path, and the updated residual capacities after each augmentation.
    (iii) Calculate the final maximum flow value.

    View this question on its own page →
  23. Q8a. Answer the following: (i) Describe complexity classes P, NP, NP-complete, and NP-hard. (ii) State and explain Cook's Theorem. (iii) Why is it considered a foundational result in computational complexity theory?20247m

    Module 4: Tractable and Intractable Problems

    Answer the following:
    (i) Describe complexity classes P, NP, NP-complete, and NP-hard.
    (ii) State and explain Cook's Theorem.
    (iii) Why is it considered a foundational result in computational complexity theory?

    View this question on its own page →
  24. Q8b. Answer the following: (i) What is polynomial-time reduction? (ii) How is it used to prove that a problem is NP-complete? (iii) Explain the process of reducing 3-SAT to Vertex Cover.20247m

    Module 4: Tractable and Intractable Problems

    Answer the following:
    (i) What is polynomial-time reduction?
    (ii) How is it used to prove that a problem is NP-complete?
    (iii) Explain the process of reducing 3-SAT to Vertex Cover.

    View this question on its own page →
  25. Q9a. Answer the following: (i) Describe randomized algorithms. (ii) Write the algorithm for randomized quick sort. (iii) Give the time complexity of randomized quick sort.20247m

    Module 5: Advanced Topics

    Answer the following:
    (i) Describe randomized algorithms.
    (ii) Write the algorithm for randomized quick sort.
    (iii) Give the time complexity of randomized quick sort.

    View this question on its own page →
  26. Q9b. Write short notes on the following: (i) Approximation algorithms. (ii) Why are they important in the context of NP-hard optimization problems? (iii) Describe how approximation algorithms can be applied to the Vertex Cover problem.20247m

    Module 5: Advanced Topics

    Write short notes on the following:
    (i) Approximation algorithms.
    (ii) Why are they important in the context of NP-hard optimization problems?
    (iii) Describe how approximation algorithms can be applied to the Vertex Cover problem.

    View this question on its own page →