diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index 80911cbf6..c03f5295e 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -13,7 +13,25 @@ "state": { "type": "markdown", "state": { - "file": "src/content/blog/computer-science-qna.md", + "file": "src/content/blog/boj-11725-트리의-부모-찾기.md", + "mode": "source", + "source": false + } + } + } + ] + }, + { + "id": "2751c6eff19f0222", + "type": "tabs", + "children": [ + { + "id": "b432993a3c090840", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "src/content/blog/boj-1026-보물.md", "mode": "source", "source": false } @@ -85,7 +103,7 @@ "state": { "type": "backlink", "state": { - "file": "src/content/blog/computer-science-qna.md", + "file": "src/content/blog/boj-11725-트리의-부모-찾기.md", "collapseAll": false, "extraContext": false, "sortOrder": "alphabetical", @@ -102,7 +120,7 @@ "state": { "type": "outgoing-link", "state": { - "file": "src/content/blog/computer-science-qna.md", + "file": "src/content/blog/boj-11725-트리의-부모-찾기.md", "linksCollapsed": false, "unlinkedCollapsed": true } @@ -125,7 +143,7 @@ "state": { "type": "outline", "state": { - "file": "src/content/blog/computer-science-qna.md" + "file": "src/content/blog/boj-11725-트리의-부모-찾기.md" } } } @@ -150,6 +168,9 @@ }, "active": "3102d8e704fadc57", "lastOpenFiles": [ + "src/content/blog/computer-science-qna.md", + "src/content/blog/boj-1026-보물.md", + "src/content/blog/boj-11725-트리의-부모-찾기.md", "src/content/blog/boj-15663-N과-M-(9).md", "dist/assets/forrest-gump-quote@900w.jpeg", "dist/assets/forrest-gump-quote.webp.jpg", @@ -174,7 +195,6 @@ "src/content/blog/boj-15664-N과-M-(10).md", "src/content/blog/boj-1935-후위-표기식2.md", "src/content/blog/boj-10819-차이를-최대로.md", - "src/content/blog/boj-1026-보물.md", "src/content/blog/programmers-보호소에서-중성화한-동물.md", "src/content/blog/programmers-즐겨찾기가-가장-많은 식당-정보-출력하기.md", "src/content/blog/boj-5014-스타트링크.md", @@ -193,7 +213,6 @@ "src/content/blog/update-markdown-AST-node-url-value.md", "src/content/blog/uninstall-wsl-completely-on-windows.md", "src/content/blog/wooteco-2nd-thoughts.md", - "src/content/blog/wooteco-1st-thoughts.md", - "src/content/blog/create-ssh-key-for-github.md" + "src/content/blog/wooteco-1st-thoughts.md" ] } \ No newline at end of file diff --git a/src/assets/template/oakgorithms-report-template.md b/src/assets/template/oakgorithms-report-template.md deleted file mode 100644 index 372c61eb9..000000000 --- a/src/assets/template/oakgorithms-report-template.md +++ /dev/null @@ -1,33 +0,0 @@ -## `python` 코드 - -```python - -``` - -## How to Run - -python version: `3.11.6` - -### Run `main.py` - -``` -pip install pipenv -pipenv --python 3.11.6 -pipenv run python3 main.py -``` - -### Input - -`input.txt`: - -``` - -``` - -### Output - -```zsh - -``` - -## Execution Image diff --git "a/src/content/blog/boj-11725-\355\212\270\353\246\254\354\235\230-\353\266\200\353\252\250-\354\260\276\352\270\260.md" "b/src/content/blog/boj-11725-\355\212\270\353\246\254\354\235\230-\353\266\200\353\252\250-\354\260\276\352\270\260.md" new file mode 100644 index 000000000..7797165e2 --- /dev/null +++ "b/src/content/blog/boj-11725-\355\212\270\353\246\254\354\235\230-\353\266\200\353\252\250-\354\260\276\352\270\260.md" @@ -0,0 +1,60 @@ +--- +author: Gyunseo Lee +title: "BOj 백준 11725: 트리의 부모 찾기" +pubDatetime: 2024-04-28T23:40:00+09:00 +modDatetime: 2024-04-28T23:40:00+09:00 +featured: false +draft: false +tags: + - PS + - Algorithms + - BOJ + - BFS + - 실랜디 +description: "\b백준 11725: 트리의 부모 찾기 풀이 과정" +ogImage: "" +--- + +## Table of contents + +## 들어가며 + +이 문제는 BFS를 돌리면서 각 노드를 방문하고, 각 노드에 대해 직전에 방문했던 노드를 기록해주는 리스트를 만들어서 기록해주어서 푸는 문제이다. + +## 풀이 과정 + +![](https://res.cloudinary.com/gyunseo-blog/image/upload/f_auto/v1714315356/image_ecudal.png) + +## AC 받은 Python 코드 + +```python +import sys +from collections import deque + +input = sys.stdin.readline + + +if __name__ == "__main__": + N = int(input().rstrip()) + graph = [[] for _ in range(N + 1)] + isVisited = [False for _ in range(N + 1)] + pre = [0 for _ in range(N + 1)] + for _ in range(N - 1): + u, v = map(int, input().rstrip().split()) + graph[u].append(v) + graph[v].append(u) + q = deque() + isVisited[1] = True + q.append(1) + while q: + cur = q.popleft() + for nv in graph[cur]: + if isVisited[nv]: + continue + isVisited[nv] = True + pre[nv] = cur + q.append(nv) + for i in range(2, N + 1): + print(pre[i]) + +``` diff --git a/src/content/blog/computer-science-qna.md b/src/content/blog/computer-science-qna.md index 27655fcbe..b867dec28 100644 --- a/src/content/blog/computer-science-qna.md +++ b/src/content/blog/computer-science-qna.md @@ -16,3 +16,7 @@ description: 인터뷰 대비 CS 공부도 틈틈히 하자... 다들 밑의 질문에 대답할 정도로 공부해 봅시다. 🚀🚀🚀 ## DB의 Connection Pool에 대해 설명해 주세요 + +## 3-Way Handshake에 대해 설명해 주세요 + +## 4-Way Handshake에 대해 설명해 주세요