그리디(Greedy) - 최소신장트리(MST)
·
💻 알고리즘/이론
kruskal 알고리즘 구현(c언어) #include #include typedef struct Edge { char v1, v2; int weight; struct Edge* next; }Edge; typedef struct IncidentEdge { char aName; Edge* e; struct IncidentEdge* next; }IncidentEdge; typedef struct Vertex { char vName; IncidentEdge* iHead; struct Vertex* next; }Vertex; typedef struct { Vertex* vHead; Edge* eHead; int eCount, vCount; }Graph; void init(Graph* G) { G->vHead = ..