일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 프로그래머스
- 109. Convert Sorted List to Binary Search Tree
- kaggle
- Convert Sorted List to Binary Search Tree
- data science
- 밴픽
- Substring with Concatenation of All Words
- 시바견
- Python Implementation
- Class
- Python
- Protocol
- Regular Expression
- 컴퓨터의 구조
- t1
- concurrency
- 파이썬
- iterator
- DWG
- 30. Substring with Concatenation of All Words
- 운영체제
- Generator
- Decorator
- attribute
- LeetCode
- 715. Range Module
- Python Code
- 315. Count of Smaller Numbers After Self
- shiba
- 43. Multiply Strings
Archives
- Today
- Total
목록위상 정렬 (1)
Scribbling
위상 정렬
위상 정렬: 방향 그래프의 모든 노드를 '방향성에 거스르지 않도록' 순서대로 나열하는 알고리즘 def topology_sort(): result = [] q = deque() """ 진입 차수가 0인 node를 queue에 삽입 """ for i in range(1, v+1): if indegree_list[i] == 0: q.append(i) while q: now = q.popleft() result.append(now) """ queue에서 꺼낸 node와 연결된 모든 node 간의 간선을 제거 후 진입 차수가 0인 node를 queue에 삽입 """ for nxt in graph[now]: indegree_list[nxt] -= 1 if indegree_list[nxt] == 0: q.append..
Computer Science/Algorithms & Data Structures
2021. 8. 14. 17:37