mirror of
https://github.com/TheAlgorithms/C.git
synced 2026-02-18 22:00:14 +00:00
[PR #1478] kruskal.c #2079
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/TheAlgorithms/C/pull/1478
State: closed
Merged: No
Added Kruskal's Algorithm in C
Implemented Kruskal’s Algorithm using Union-Find (Disjoint Set).
Takes user input, sorts edges, builds MST, and prints total weight.
File: kruskal.c
Sample Input:
4 5
0 1 10
0 2 6
0 3 5
1 3 15
2 3 4
Sample Output:
Edges in Minimum Spanning Tree:
2 - 3 : 4
0 - 3 : 5
0 - 1 : 10
Total Weight of MST: 19