ADA_Lab_Program 1 & 2
ADA_Lab_Program 1 & 2
Design and implement C/C++ Program to find Minimum Cost Spanning Tree of a given
connected undirected graph using Kruskal's algorithm.
#include<stdio.h>
#define INF 999 // Define a large value to represent infinity (no direct edge)
#define MAX 100 // Maximum number of nodes
int p[MAX], c[MAX][MAX], t[MAX][2]; // Parent array, Cost matrix, MST edges array
return 0;
}
OUTPUT
Design and implement C/C++ Program to find Minimum Cost Spanning Tree of a given
connected undirected graph using Prim's algorithm.
#include <stdio.h>
#define INF 999 // Define a large value to represent infinity (no direct edge)
}
}
}
return 0;
}
OUTPUT
Enter n value: 4
Enter the graph data (use 999 for INF):
4521
7592
1769
0285