mirror of
https://github.com/TheAlgorithms/C.git
synced 2026-02-04 05:44:35 +00:00
[PR #815] [MERGED] feat: Prims algorithm #1332
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?
📋 Pull Request Information
Original PR: https://github.com/TheAlgorithms/C/pull/815
Author: @Sl1mb0
Created: 3/19/2021
Status: ✅ Merged
Merged: 3/31/2021
Merged by: @ayaankhan98
Base:
master← Head:prims-algorithm📝 Commits (10+)
4f165adAdded prim.c887d24aUpdated formatting in prim.c3775104Docs: updated prim.c documentation8fda51dfeat: Included testing in prim.c25fc9cefeat: eliminated globals & changed variable types2b2177eDocs: added documentation for minimum function323837fupdating DIRECTORY.mda48e6e8Updated documentation2ad0af6Docs: Changed function docs & made test function static88b1585Docs: made further requested changes📊 Changes
2 files changed (+204 additions, -0 deletions)
View changed files
📝
DIRECTORY.md(+1 -0)➕
greedy_approach/prim.c(+203 -0)📄 Description
Description of Change
I implemented prim's algorithm and added
prim.ctoTheAlgorithms/C/greedy_approach.Prim's algorithm finds a minimum spanning tree of a weighted, connected graph.
Using a 'greedy' approach to generate the MST, the algorithm searches for a minimally weighted, non-visited edge, and adds the vertex connected by that edge to the MST.
To test, compile and run.
Enter in adjacency matrix of a weighted, connected graph.
References
pg. 319 "Introduction to the Design and Analysis of Algorithms" - Anany Levitin
Checklist
Notes:
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.