Design and Analysis of Algorithms

106502
Back to Design and Analysis of Algorithms

Module 3: Graph and Tree Algorithms

  1. Q1a. An adjacency matrix representation of a graph cannot contain information of (i) nodes (ii) edges (iii) direction of edges (iv) parallel edges20222m

    Module 3: Graph and Tree Algorithms

    An adjacency matrix representation of a graph cannot contain information of
    (i) nodes
    (ii) edges
    (iii) direction of edges
    (iv) parallel edges

    View this question on its own page →
  2. 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) 120222m

    Module 3: Graph and Tree Algorithms

    The minimum number of colors needed to color a graph having n>3n > 3 vertices and 2 edges is
    (i) 2
    (ii) 3
    (iii) 4
    (iv) 1

    View this question on its own page →
  3. Q1c. Which of the following algorithms is used to find the minimum spanning tree in a weighted undirected graph? (i) Dijkstra's algorithm (ii) Kruskal's algorithm (iii) Bellman-Ford algorithm (iv) Floyd-Warshall algorithm20232m

    Module 3: Graph and Tree Algorithms

    Which of the following algorithms is used to find the minimum spanning tree in a weighted undirected graph?
    (i) Dijkstra's algorithm
    (ii) Kruskal's algorithm
    (iii) Bellman-Ford algorithm
    (iv) Floyd-Warshall algorithm

    View this question on its own page →
  4. Q1d. BFS on a graph G = (V, E) has running time (i) O(|V| + |E|) (ii) O(|V|) (iii) O(|E|) (iv) None of these20222m

    Module 3: Graph and Tree Algorithms

    BFS on a graph G=(V,E)G = (V, E) has running time
    (i) O(V+E)O(|V| + |E|)
    (ii) O(V)O(|V|)
    (iii) O(E)O(|E|)
    (iv) None of these

    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. Q1e. In an unweighted graph, which algorithm is guaranteed to find the shortest path between two nodes? (i) Depth First Search (ii) Kruskal's Algorithm (iii) Breadth First Search (iv) Prim's Algorithm20252m

    Module 3: Graph and Tree Algorithms

    In an unweighted graph, which algorithm is guaranteed to find the shortest path between two nodes?

    (i) Depth First Search
    (ii) Kruskal's Algorithm
    (iii) Breadth First Search
    (iv) Prim's Algorithm

    View this question on its own page →
  7. 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 →
  8. Q1f. Which of the following algorithms is commonly used to find the Minimum Spanning Tree of a graph? (i) Dijkstra's Algorithm (ii) Kruskal's Algorithm (iii) Bellman-Ford Algorithm (iv) Floyd-Warshall Algorithm20252m

    Module 3: Graph and Tree Algorithms

    Which of the following algorithms is commonly used to find the Minimum Spanning Tree of a graph?

    (i) Dijkstra's Algorithm
    (ii) Kruskal's Algorithm
    (iii) Bellman-Ford Algorithm
    (iv) Floyd-Warshall Algorithm

    View this question on its own page →
  9. Q1g. Which of the following algorithm solves the All Pair Shortest Path problem (i) Dijkstra's (ii) Floyd's Warshall's (iii) Prim's (iv) Kruskal's20222m

    Module 3: Graph and Tree Algorithms

    Which of the following algorithm solves the All Pair Shortest Path problem
    (i) Dijkstra's
    (ii) Floyd's Warshall's
    (iii) Prim's
    (iv) Kruskal's

    View this question on its own page →
  10. 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 →
  11. Q1g. If all edge weights in a graph are positive, what is the minimum number of edges in a spanning tree for a graph with vertices? (i) V (ii) V-1 (iii) V+1 (iv) 2V20252m

    Module 3: Graph and Tree Algorithms

    If all edge weights in a graph are positive, what is the minimum number of edges in a spanning tree for a graph with vertices?

    (i) V
    (ii) V-1
    (iii) V+1
    (iv) 2V

    View this question on its own page →
  12. 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 →
  13. Q1i. What is the time complexity of topological sorting of a directed acyclic graph (DAG) with V vertices and E edges using Depth-First Search (DFS)? (i) O(V^2) (ii) O(E^2) (iii) O(V+E) (iv) O(V.E)20232m

    Module 3: Graph and Tree Algorithms

    What is the time complexity of topological sorting of a directed acyclic graph (DAG) with VV vertices and EE edges using Depth-First Search (DFS)?
    (i) O(V2)O(V^2)
    (ii) O(E2)O(E^2)
    (iii) O(V+E)O(V+E)
    (iv) O(V.E)O(V.E)

    View this question on its own page →
  14. Q3a. Give step by step procedure to find minimal spanning tree for the given graph. ![image](https://9lrt4yspyx.ufs.sh/f/z1z03jdN1p04sU7KeS0RokTQjiuapSXvByEJLFr8weIGhWCq)20227m

    Module 3: Graph and Tree Algorithms

    Give step by step procedure to find minimal spanning tree for the given graph.

    image

    View this question on its own page →
  15. Q3b. What is a Minimum Cost Spanning tree? Explain Kruskal's Minimum cost spanning tree algorithm with a suitable example.20257m

    Module 3: Graph and Tree Algorithms

    What is a Minimum Cost Spanning tree? Explain Kruskal's Minimum cost spanning tree algorithm with a suitable example.

    View this question on its own page →
  16. Q4a. Solve the single source shortest path problem for the following graph considering '1' as the source vertex using Dijkstra's algorithm. ![image](https://9lrt4yspyx.ufs.sh/f/z1z03jdN1p04cA0M12VDrIj0ikyQ82dzRXKGqChPbOmcuBt6)20227m

    Module 3: Graph and Tree Algorithms

    Solve the single source shortest path problem for the following graph considering '1' as the source vertex using Dijkstra's algorithm.

    image

    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. Q5a. Explain BFS algorithm in detail. Also explain its time complexity.20257m

    Module 3: Graph and Tree Algorithms

    Explain BFS algorithm in detail. Also explain its time complexity.

    View this question on its own page →
  19. 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 →
  20. Q5b. Explain how Bellman Ford algorithm can be used to detect the presence of negative weight cycles.20257m

    Module 3: Graph and Tree Algorithms

    Explain how Bellman Ford algorithm can be used to detect the presence of negative weight cycles.

    View this question on its own page →
  21. Q6a. In the below given weighted graph W (Given in form of matrix), apply Bellman Ford's algorithm to find the shortest distances from source node 3. Write the time complexity of Bellman Ford's algorithm. | | 1 | 2 | 3 | 4 | 5 | |---|---|---|---|---|---| | 1 | 0 | 1 | 8 | 1 | 4 | | 2 | 1 | 0 | 12 | 4 | 9 | | 3 | 8 | 12 | 0 | 7 | 3 | | 4 | 1 | 4 | 7 | 0 | 2 | | 5 | 4 | 9 | 3 | 2 | 0 |20237m

    Module 3: Graph and Tree Algorithms

    In the below given weighted graph W (Given in form of matrix), apply Bellman Ford's algorithm to find the shortest distances from source node 3. Write the time complexity of Bellman Ford's algorithm.

    1 2 3 4 5
    1 0 1 8 1 4
    2 1 0 12 4 9
    3 8 12 0 7 3
    4 1 4 7 0 2
    5 4 9 3 2 0
    View this question on its own page →
  22. 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 →
  23. Q6a. Explain the Prim's algorithm. What is the time complexity of Prim's algorithm?20257m

    Module 3: Graph and Tree Algorithms

    Explain the Prim's algorithm. What is the time complexity of Prim's algorithm?

    View this question on its own page →
  24. Q6b. What is minimum spanning tree (MST)? Explain the steps of Prim's algorithm to find the MST using an example.20237m

    Module 3: Graph and Tree Algorithms

    What is minimum spanning tree (MST)? Explain the steps of Prim's algorithm to find the MST using an example.

    View this question on its own page →
  25. 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 →
  26. Q6b. Apply the Prim's algorithm and find the optimal solution for the following graph: ![Prim's Algorithm Graph](https://res.cloudinary.com/dvrkysimk/image/upload/v1780226131/image_anpxgf.png)20257m

    Module 3: Graph and Tree Algorithms

    Apply the Prim's algorithm and find the optimal solution for the following graph:

    Prim's Algorithm Graph

    View this question on its own page →
  27. Q7a. What is negative weight-cycle? Write Bellman-Ford algorithm to find single source shortest distance of a directed graph.20227m

    Module 3: Graph and Tree Algorithms

    What is negative weight-cycle? Write Bellman-Ford algorithm to find single source shortest distance of a directed graph.

    View this question on its own page →
  28. Q7a. Discuss the differences between BFS and DFS in terms of traversal order, memory usage, and their applications in real-world problems.20237m

    Module 3: Graph and Tree Algorithms

    Discuss the differences between BFS and DFS in terms of traversal order, memory usage, and their applications in real-world problems.

    View this question on its own page →
  29. 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 →
  30. 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 →