Question

Consider the following Graph: 

Image ignouacademy-com--p-2024-96186

Figure 1: Graph for Problem 3(a) and 3(b)

a) Write the Kruskal’s algorithm and Prim’s algorithm to find the minimum cost
spanning tree of the graph given in Figure 1. Show all the steps of computation.
Also, compute the time complexity of both the algorithms.
b) In the Figure 1, find the shortest path from the vertex ‘a’ using Dijkstra’s shortest
path algorithm. Show all the steps of computation. Also, find the time complexity
of the algorithm.
c) What is dynamic programming? What is the principle of Optimality? Use the
dynamic programming approach to find the optimal sequence of chain
multiplication of the following matrices:

                  Matrix   Dimension
  A1   5 × 10
  A2   10 × 20
  A3   20 × 15
  A4   15 × 8
  A5   8 × 10

d) Make all the possible Binary Search Trees for the key values 25, 50, 75. e) Explain the Knuth Morris Pratt algorithm for string matching. Use this algorithm to find a pattern “algo” in the Text “From algae to algorithms”. Show all the steps. What is the time complexity of this algorithm.

07 Mar 2024
Answer :
Word Count : 701
### a) Kruskal’s and Prim’s Algorithms for Minimum Spanning Tree (MST) #### Kruskal’s Algorithm: Kruskal’s algorithm builds the MST by sorting all the edges in the graph in increasing order of their weight and adding the smallest edge that doesn’t form a cycle. Steps: 1. Sort all edges in non-decreasing order of weight. 2. Initialize a disjoint set (Union-Find) to keep track of connected components. 3. Iterate through the sorted edges and add the edge to the MST if it doesn’t form a cycle. 4. Repeat until \(V-1\) edges are added (where \(V\) is the number of vertices). Time Complexity: - Sorting edges: \(O(E \log E)\) - Union-Find operations: \(O(E \log V)\) - Total: \(O(E \log E)\) #### Prim’s Algorithm: Prim’s algorithm builds the MST by starting from an arbitrary vertex and adding the smallest edge that connects the tree to a new vertex. Steps: 1. Start with an arbitrary vertex and add it to the MST. 2. Use a priority queue to store edges connected to the
________ ________ _____ ___ ___ _________ _____ _______ ______ _______.
__________ _____ ________ _________ _________ ________ _____ ______ ___ _______ _________ ____.
_______ ____ ________ __________ ______ ______ _____.
_________ ___ _____ _________ ____ _____ ____ ______.
____ ___ _________ __________ _________ ________ ____ ________.
_______ _____ ____ ___ _____ _______.
__________ ____ _____ ____ ____ ________ ____ ___.
________ ___ ________ ____ _______ _____ __________ ____ _______ __________.
_______ ________ ________ _____ ______ ______ _______ __________ ____ ________ _____.
___ _________ ___ ____ ____ ____ _________ __________ _______ ________ ______.
_________ ___ ____ ___ ____ _________ ________.
________ __________ _____ _______ ____ ________ _______ ____ ____ _________.
_____ __________ ____ ___ _________ _____ ____ ______ __________ _______.
___ ____ ___ _________ ______ ___.
______ _______ ___ ______ _______ ___ ____ _________ ______.
________ ____ ________ _______ _________ ____ ______ _______ _______ _____ _______ __________.
_________ _____ _______ _____ ________ _______ _____ ____ _________ ___ ___ ________.
___ _______ __________ ________ ____ ______.
_______ __________ _____ ________ ___ _____ ____ __________.
__________ ________ ________ _____ ________ ______ ________ _______.
__________ ______ ______ _________ ____ _________ ________ ______.
_________ _______ ________ ___ ____ ______ __________ ________ ___ ____.
_______ ______ _____ _________ ____ __________ __________.
_____ __________ ______ _______ ___ _________ _____ ____ __________ _____ _____.
____ _______ _________ ___ ___ ____ _______ ________ _________.
________ ____ _________ ______ ____.
________ ____ ________ ______ _________ __________ _________.
____ __________ ______ _______ _________ ___ ____ _____ ___ ______ __________ ____.
_____ ____ _____ ________ ______ __________ _________ _______ _______ ______.
____ _____ _________ __________ _________ ______.
_________ ____ _______ ____ _________ _____ ______ __________ ____ _______.
_____ ________ _______ ________ ______ ______ ___ _______ ________ _________ _____ ______.
___ _____ _______ ______ ____ ____ _________ _______ _________ _____.
_____ __________ __________ _____ ___ _________ _______.
_______ ______ ____ ___ _____ _____.
_____ ___ ___ ___ __________ ___ ________ _______ _________.
__________ _____ _______ _______ ___ _______.
_____ ________ ___ _________ ___ _______.
_____ __________ _______ ___ _________ ________ _______.
__________ _______ _________ _________ ______ ______ _____ __________ ____ _____.
_____ ____ _________ _______ ________ ___ _____ ___.
____ _______ _____ __________ ____ _______ _____.
______ __________ ___ ___ ___ ___.
____ _____ _____ _____ ______ _________ ____ ____ ____ ________.
___ ________ _______ __________ _________ _____ _________.
__________ ______ _____ ____ ________ _________.
______ _________ _____ _______ ___ ____ ____ __________ _________ ________ ______ ______.
____ ______ _________ __________ _________ _______ ________ _______ _____ ____.
__________ _________ ___ _________ ___ ____ _______ ______ ______ __________ ______.
_______ __________ _____ __________ __________ ________ _____ __________ ___ ______.
________ _________ ___ _________ ___ _____ ____ ___ ___ __________.
___ ____ __________ ______ ____ ______ _______ _________ _________ ___.
___ __________ ________ ________ _________ ________ ___ ___ _____ ___ ____ ________.
______ ____ _____ _________ ____ ______.
__________ ____ __________ _____ _____ _______ ______ _____ ______ ______ ________ _____.
_______ __________ _____ _____ ________ ________ _______ ______ _______ ___ _______ ________.
___ _____ ___ ________ ________ ___ _________ _____.
____ _______ ______ ____ _______.
____ __________ ______ ______ ______ ___ ________ _________ __________.
_______ _______ _____ ______ _______ _______ _______.
__________ _______ ____ ____ ___ _________ ___ ___.
IGNOU ACADEMY
Your IGNOU journey, made easier.
  • Solved Assignments
  • Study Notes
  • Guess Papers
  • Question Papers
Skip in 10
Top
📞
Call Support Instant phone assistance IGNOU MCS 211 2024 - Consider the following Graph: Figure 1: Graph for Problem | IGNOU Academy
→
🟢
WhatsApp Chat Fast live messaging
→
Email Us Business enquiries & support
→