
Prim Algorithm Coding
·
CS/Algorithm
Prim을 위해 만들어야할 것priority queue노드 Marking 배열그래프#include #include using namespace std;//TRI를 만들 것 노드, 노드 , wight 형태로 저장되는 것class TRI {public: int a, b, w;};//priority queueclass PQ {public: int n; TRI Arr[1000]; PQ(); //생성자 TRI Delete(); //삭제 void Insert(TRI x); //삽입 int isEmpty(); //비어있는지 확인};PQ::PQ(){ n = 0;}int PQ::isEmpty(){ return n == 0; //n에 들어있는게 없다면 0을 리턴}//prio..