Kruskal's Algorithm

유진·2022년 11월 28일

알고리즘

목록 보기
1/2

Kruskal's Algorithm

Pesudo Code

CPP로 구현하기

Vector 사용하기
벡터 안에 3가지 요소를 넣고 싶다면!?!?!
페어를 두 번 쓰면 된다.

//선언
vector<pair<int, pair<int, int>>> F;


//넣기
F.push_back({W[i].first, {W[i].second.first, W[i].second.second}});

//출력
for (int i = 0; i < v-1; i++)
        cout << F[i].first << " " << F[i].second.first << " " << F[i].second.second << endl;
profile
안드로이드... 좋아하세요?

0개의 댓글