크루스칼 알고리즘(Kruskal's Algorithm)
2020. 3. 1.
Kruskal's Algorithm 최소 비용 신장 부분 그래프를 찾는 알고리즘 #include #include #include using namespace std; int getParent(int parent[], int x){ if(parent[x] == x) return x; return parent[x] = getParent(parent,parent[x]); } int unionParent(int parent[],int a, int b){ a = getParent(parent,a); b = getParent(parent,b); if(anode[0] = a; this ->node[1] = b; this -> distance = distance; } bool operatordistance