일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
Tags
- Python
- dynaminprogramming
- 2909
- Crawling
- NAV
- HTML
- springboot3.x
- baekjun
- Algorythm
- CSS
- node.js
- raspberrypi
- algotythm
- nav-tab
- 파이썬
- 라즈베리파이3b+
- 알고리즘
- 2579
- 백준
- dp
- ubuntu
- 트리
- 라즈베리파이
- 라즈베리파이3
- 16.04
- 13237
- MongoDB
- 라즈비안
- bootstrap
- 크롤링
Archives
- Today
- Total
목록트리 (2)
노트
[백준] 1991번 트리 순회 python
n = int(input()) tree = {} for _ in range(n): root, left, right = input().split() tree[root] = [left,right] def preorder(a): if a is not '.': print(a,end='') preorder(tree[a][0]) preorder(tree[a][1]) def inorder(a): if a is not '.': inorder(tree[a][0]) print(a,end='') inorder(tree[a][1]) def postorder(a): if a is not '.': postorder(tree[a][0]) postorder(tree[a][1]) print(a,end='') preorder('A') ..
알고리즘
2023. 9. 12. 13:47
[백준] 14267번 회사 문화 1 python
import sys sys.setrecursionlimit(10 ** 6) a,b = map(int,input().split()) boss = list(map(int,input().split())) gujo = [[] for _ in range(a)] my_boss = [0]*(a+1) ans = [0]*(a+1) for i in range(1,a): if boss[i]!=-1: gujo[boss[i]].append(i+1) my_boss[i+1]=boss[i] def tamsaek(k): ans[k] += ans[my_boss[k]] if k
알고리즘
2023. 6. 17. 22:31