Skip to content

Commit

Permalink
2024-04-28 23:42:52
Browse files Browse the repository at this point in the history
Affected files:
.obsidian/workspace.json
src/assets/template/oakgorithms-report-template.md
src/content/blog/boj-11725-트리의-부모-찾기.md
src/content/blog/computer-science-qna.md
  • Loading branch information
gyunseo committed Apr 28, 2024
1 parent 2a380b6 commit 77e9feb
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 40 deletions.
33 changes: 26 additions & 7 deletions .obsidian/workspace.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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",
Expand All @@ -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
}
Expand All @@ -125,7 +143,7 @@
"state": {
"type": "outline",
"state": {
"file": "src/content/blog/computer-science-qna.md"
"file": "src/content/blog/boj-11725-트리의-부모-찾기.md"
}
}
}
Expand All @@ -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/[email protected]",
"dist/assets/forrest-gump-quote.webp.jpg",
Expand All @@ -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",
Expand All @@ -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"
]
}
33 changes: 0 additions & 33 deletions src/assets/template/oakgorithms-report-template.md

This file was deleted.

60 changes: 60 additions & 0 deletions src/content/blog/boj-11725-트리의-부모-찾기.md
Original file line number Diff line number Diff line change
@@ -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])

```
4 changes: 4 additions & 0 deletions src/content/blog/computer-science-qna.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ description: 인터뷰 대비 CS 공부도 틈틈히 하자...
다들 밑의 질문에 대답할 정도로 공부해 봅시다. 🚀🚀🚀

## DB의 Connection Pool에 대해 설명해 주세요

## 3-Way Handshake에 대해 설명해 주세요

## 4-Way Handshake에 대해 설명해 주세요

0 comments on commit 77e9feb

Please sign in to comment.