트리 (tree) 자료구조의 일종 사이클이 없는 연결 그래프 정점의 개수 : V 간선의 개수 : V-1 정점 V, 간선 V 개 라면 사이클이 1개 있다. 정점 V, 간선 V-1 개라면 트리라 할 수 있을까 ? 아니다. 왜냐면 연결이 되어있지 않다. 정점 V, 간선 V-1 개 라는것은 트리의 성질이다. 트리가 맞을려면 연결되어있다는 조건이 추가되어야 한다. 트리를 구성하는 요소 - node - edge root - 트리의 가장 윗부분에 위치하는 노드 - 하나의 트리에는 하나의 루트가 존재 reaf (terminal node, external node) - 트리의 가장 아랫부분에 위치하는 노드 - 더 이상 뻗어나갈 수 없는 마지막 노드 Parent - Parent가 없는 V를 Root라고 할 수 있다. Ch..
import java.io.*; import java.util.*; public class Main { static int N, M, person1, person2, x, y; static LinkedList[] nodeList; static boolean[] visited; static boolean check; static class Node { int index; int distance; public Node(int index, int distance) { this.index = index; this.distance = distance; } } public static void bfs(int start, int end) { Queue q = new LinkedList(); q.offer(new No..
import java.io.*; import java.util.*; public class Main { static int N, M; static int[][] graph; static int[] dx = {-1, 1, 0, 0}; static int[] dy = {0, 0, -1, 1}; // x,y 좌표가 함께 움직야하고, 날짜를 세야하는데 그걸 클래스 안에 넣었음 static class Dot { int x; int y; int day; public Dot(int x, int y, int day) { this.x = x; this.y = y; this.day = day; } } public static void main(String[] args) throws IOException { input();..
import java.io.*; import java.util.LinkedList; import java.util.Queue; import java.util.StringTokenizer; class Node { int index; int distance; public Node(int index, int distance) { this.index = index; this.distance = distance; } public int getIndex() { return index; } public int getDistance() { return distance; } } public class Main { static int n, m, nx, ny; static int[][] graph = new int[101]..
import java.io.*; import java.util.StringTokenizer; public class Main { static int t, m, n, k, x, y, ans; static int[][] graph = new int[50][50]; public static boolean dfs(int x, int y) { if (x = m || y = n) { return false; } if (graph[x][y] == 1) { graph[x][y] = 0; dfs(x - 1, y); dfs(x + 1, y); dfs(x, y - 1); dfs(x, y + 1); return true; } return false; } public static void m..
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Main { static int n, danjiCnt; static int[][] graph = new int[26][26]; static int[] num = new int[26*26]; static boolean dfs (int x, int y) { if (x n || y n) { return false; } // 단지가 될 수 있다면 if (graph[x][y] == 1) { graph[x][y] = 0; num[danjiCnt]++; d..
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Main { static int n, m, node1, node2, cnt; static LinkedList[] nodeList; static boolean[] visited = new boolean[101]; public static void dfs(int node) { if (visited[node]) return; visited[node] = true; cnt++; for (int nextNode : nodeList[node]) { dfs(nextNode); } } public..
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Main { static int n, m, v; static LinkedList[] nodeList; static boolean[] checked = new boolean[1001]; static boolean[] checked2 = new boolean[1001]; public static void dfs(int node) { if (checked[node]) return; checked[node] = true; System.out.print(node + " "); for (int..
- Total
- Today
- Yesterday
- ㅇㄷㅇㅈ
- 프로그래머스
- HTTP 완벽가이드
- REST API
- 킹수빈닷컴
- JS 딥다이브
- 모던자바스크립트
- HTTP 완벽 가이드
- 가상 면접 사례로 배우는 대규모 시스템 설계 기초
- 이펙티브자바
- 김영한 JPA
- Spring Security
- 백기선 스터디
- 김영한 http
- 백준
- dreamcoding
- GCP
- 이펙티브자바 스터디
- 이펙티브자바 아이템59
- js promise
- http
- 드림코딩
- 패스트캠퍼스 컴퓨터공학 완주반
- js array
- 프로그래머스 SQL
- js api
- BOJ
- JPA 연관관계 매핑
- java
- 이펙티브자바 아이템60
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |