다익스트라(Dijkstra) - 최단경로 찾기
·
Java & Spring/알고리즘
□ 예제 : https://www.acmicpc.net/problem/1916□ 사용처 : 가중치가 있는 그래프에서 최단 경로를 찾는 알고리즘으로, 음수 가중치가 없는 경우에만 사용 □ 구현1. 변수선언 static int N; static int M; static List[] bus; static int[] cost; static boolean[] check;N : 종점 수M : 노선 수List[] bus : 버스 노선 인접리스트cost : 비용 배열2. Node 클래스 선언 static class Node { int destination; int cost; public Node(int e, int cost) { ..