일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- 백트래킹
- Brute-force
- 네트워크
- 프로젝트
- DFS
- 모던자바
- lambda
- kotlin
- 스프링
- programmers
- backtracking
- TDD
- algorithm
- DP
- LEVEL2
- Spring
- back-end
- 그래프
- Java8
- 백준
- BFS
- 자료구조
- 운영체제
- java
- baekjoon
- 코틀린
- 자바
- OS
- 알고리즘
- 프로그래머스
- Today
- Total
목록프림 (2)
요깨비's LAB

import java.util.ArrayList; import java.util.List; import java.util.PriorityQueue; import java.util.Scanner; class Vertax { int id; boolean isVisited; List edges; public Vertax(int id) { this.id = id; this.isVisited = false; this.edges = new ArrayList(); } } class Edge { int from; int to; int value; public Edge(int from, int to, int value) { this.from = from; this.to = to; this.value = value; } ..

이번에는 프림 알고리즘 방식으로 풀었습니다. 이것 또한 정점과 간선을 인스턴스화 하여 풀었습니다. import java.util.*; class Vertax { int id; boolean isVisited; List linkedVertaxes; public Vertax(int id) { this.id = id; this.isVisited = false; this.linkedVertaxes = new ArrayList(); } } class Edge { int toId; int value; public Edge(int toId, int value) { this.toId = toId; this.value = value; } } public class Main { public static void main(..