일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- Class
- iterator
- Protocol
- LeetCode
- concurrency
- 시바견
- shiba
- Generator
- 30. Substring with Concatenation of All Words
- 프로그래머스
- 43. Multiply Strings
- DWG
- attribute
- 밴픽
- Regular Expression
- Substring with Concatenation of All Words
- 315. Count of Smaller Numbers After Self
- Python Implementation
- data science
- 109. Convert Sorted List to Binary Search Tree
- Convert Sorted List to Binary Search Tree
- Python Code
- kaggle
- Python
- 파이썬
- 컴퓨터의 구조
- Decorator
- 운영체제
- 715. Range Module
- t1
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