## Minimum Spanning Tree (MST)?

Minimum Spanning Tree (MST) is a subset of edges in an undirected weighted graph that connects all the vertices with the minimum possible total edge weight. It is a very important problem in graph theory and has various practical applications, such as in network design and clustering algorithms.

## Prim’s Algorithm

Prim’s Algorithm is a popular algorithm for finding the Minimum Spanning Tree of a weighted, undirected graph. The algorithm works by starting with an arbitrary vertex and greedily adding the minimum-weight edges that connect it to new vertices, until all vertices are connected in a single tree.

## Here are the steps for finding the Minimum Spanning Tree using Prim’s Algorithm:

- Initialize a set of vertices that are not included in the MST.
- Choose an arbitrary vertex to start with and add it to the MST.
- For all the edges that connect the chosen vertex to the vertices in the set of vertices that are not included in the MST, calculate the weight of the edge and select the one with the minimum weight.
- Add the selected edge and the corresponding vertex to the MST.
- Repeat steps 3-4 until all vertices are included in the MST.

## Example of finding the Minimum Spanning Tree of the following graph using Prim’s Algorithm:

2 3 A ------- B ------- C \ | / \ \ 1 | 5 / 4 \ | / \ \ | / \ \ | / \ \ | / \ \ | / \ D --------------- E 6 2

- Initialize the MST with vertex A and the set of vertices that are not included in the MST as {B, C, D, E}.
- From vertex A, the edges AB and AD are of minimum weight. Choose AB and add vertex B to the MST.
- From vertex B, the edges BC and BE are of minimum weight. Choose BC and add vertex C to the MST.
- From vertices A, B, and C, the edge AD is of minimum weight. Choose AD and add vertex D to the MST.
- From vertices A, B, C, and D, the edge DE is of minimum weight. Choose DE and add vertex E to the MST.

The resulting Minimum Spanning Tree is:

2 3 A ------- B ------- C / \ 4 / \ 5 / \ D ------------ E

In conclusion, Minimum Spanning Tree is a subset of edges in an undirected weighted graph that connects all the vertices with the minimum possible total edge weight. Prim’s Algorithm is a popular algorithm for finding the Minimum Spanning Tree of a weighted, undirected graph, and it works by starting with an arbitrary vertex and greedily adding the minimum-weight edges that connect it to new vertices, until all vertices are connected in a single tree. The steps for finding the Minimum Spanning Tree using Prim’s Algorithm involve selecting an arbitrary vertex and adding it to the MST, calculating the weights of the edges that connect it to new vertices, and repeating the process until all vertices are included in the MST.

## DAA-2022

## Q-1.

(b) Discuss the concept of asymptotic notation and its properties.

## Q-2.

## Q-3

## Q-4

What is Huffman code ? discuss the greedy algorithm for constructing the Huffman code.

## Q-5

## Q-6

## Q-7

What is bitonic sequence ? discuss bitonic sort algorithm and it’s time complexity.

## Q-8

What is sorting Network ? Discuss the structure of bubble sorting network.