알고리즘(Algorithm)/기본 코드 형식
-
[Floyd-Warshall] 플로이드 워셜 알고리즘 기본 코드 형식알고리즘(Algorithm)/기본 코드 형식 2022. 2. 21. 23:23
플로이드 워셜 알고리즘 기본 코드 형식 플로이드 워셜 알고리즘 구현을 위해 알아두어야 할 코드 템플릿 - 코딩테스트와 같은 문제 해결을 위해서는 구현력이 매우 중요 - 알고리즘에 대한 이해와 더불어 알고리즘 구현을 위한 기본적인 코드 템플릿을 익혀야 함 - 기본 코드 템플릿을 토대로 각 문제의 조건에 맞추어 답 코드를 구현 플로이드 워셜 알고리즘 중요 표인트! - 플로이드 워셜 유형의 경우 3중 for문 구현이 핵심 - 백준 11404번 플로이드 문제 참고(기본적인 플로이드 유형 알고리즘 문제) 백준 11404번 플로이드 (JAVA) 백준 11404번 플로이드 https://www.acmicpc.net/problem/11404 11404번: 플로이드 첫째 줄에 도시의 개수 n이 주어지고 둘째 줄에는 버스..
-
[Union-Find, Disjoint Set] 알고리즘 기본 코드 형식알고리즘(Algorithm)/기본 코드 형식 2022. 2. 3. 16:27
Union-Find 알고리즘 기본 코드 형식 Union-Find 알고리즘 구현을 위해 알아두어야 할 코드 템플릿 - 코딩테스트와 같은 문제 해결을 위해서는 구현력이 매우 중요 - 알고리즘에 대한 이해와 더불어 알고리즘 구현을 위한 기본적인 코드 템플릿을 익혀야 함 - 기본 코드 템플릿을 토대로 각 문제의 조건에 맞추어 답 코드를 구현 public class UnionFind { private static int[] parent; public static void main(String[] args) { //문제 input 조건 따라서 N 적절히 설정 parent = new int[N]; //초기화 for (int i = 0; i < 10; i++) { parent[i] = i; } } private sta..