-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Week11] 크루스칼, 프림 - 하은 #90
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
마지막까지 고생하셨습니다 bb
int cost = edges[i].first; | ||
int u = edges[i].second.first; | ||
int v = edges[i].second.second; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
u v 변수네이밍을 사용해서 조금 더 직관적이고 깔끔하네요 배워갑니다!
if(elec[a] && elec[b]) | ||
return; | ||
// 둘 중에 하나만 발전소와 연결된 경우 | ||
else if(elec[a] && !elec[b]){ | ||
// 발전소가 있는 지점에 연결 | ||
parent[b] = a; | ||
result += cost; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
elec배열을 초기화해주는 로직이 없는데 괜찮을까요? 선언하면서 동시에 0으로 초기화해둬도 좋을 것 같아요!
float x1 = coord[i].first; | ||
float y1 = coord[i].second; | ||
|
||
for(int j = i + 1; j < n; j++){ | ||
float x2 = coord[j].first; | ||
float y2 = coord[j].second; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저는 float 자료형을 거의 안썼던 것 같은데 (제 기억에는 소수점이 부정확,,, 했던 것 같기도 ,,?) 혹시 사용하신 이유 여쭤봐도 괜찮을까요? 배우려구요!
풀이는 주석 참고해주세요!