티스토리 뷰
-Sort 사용할 때, 정렬기준 만들기
struct edge { // 간선 정보
int x;
int y;
int cost;
}e[100000];
int node[1001]; // 노드
int compare(const edge &a, const edge &b) {
return a.cost < b.cost; //오름차순 정렬
}
//간선 비용 오름차순 정렬
sort(e, e + m, compare);
'알고리즘 > 메모' 카테고리의 다른 글
P[0] - '0' (0) | 2018.09.09 |
---|---|
투 포인터 (0) | 2018.09.02 |
tree[a - 'A'] (0) | 2018.08.27 |
시간/공간 복잡도 (0) | 2018.04.18 |
Visual Studio scanf 에러 (0) | 2018.03.18 |
댓글