Skip to content

Instantly share code, notes, and snippets.

Avatar
🐴
Effectively, Correctly

Handong Kim 201411108

🐴
Effectively, Correctly
View GitHub Profile
@201411108
201411108 / undirected_graph_input.py
Last active Jul 27, 2021
in acmicpc, undirected graph input methods
View undirected_graph_input.py
import sys
n, m, v = list(map(int, sys.stdin.readline().split())) # N개의 정점, M개의 간선, 시작 노드 V
graph = [[] for _ in range(n + 1)] # n + 1인 이유 -> 편의상, 문제에 주어지는 값 그대로를 사용하기 위해
"""dictionary 사용 시
graph = collections.defaultdict(list) # 단 이 경우, 노드를 조회할 때 list(graph) 형태로 해줘야 에러가 발생하지 않는다.
"""
# 양방향 그래프 일 경우
for _ in range(m):
@201411108
201411108 / bfs_queue.py
Created Jul 11, 2021
BFS(queue)_python
View bfs_queue.py
def bfs(start_v):
discovered = [start_v]
queue = deque()
queue.append(start_v)
while queue:
v = queue.popleft()
for w in graph[v]:
if w not in discovered:
discovered.append(w)
queue.append(w)
@201411108
201411108 / dfs_stack.py
Last active Jul 18, 2021
DFS(stack)_python
View dfs_stack.py
def iterative_dfs(start_v):
discovered = []
stack = [start_v]
while stack:
v = stack.pop()
if v not in discovered:
discovered.append(v)
for w in graph[v]:
stack.append(w)
@201411108
201411108 / dfs_recurvise.py
Last active Jul 11, 2021
DFS(recursive)_python
View dfs_recurvise.py
def recursive_dfs(v, discovered=[]):
discovered.append(v)
for w in graph[v]:
if w not in discovered:
discovered = recursive_diff(w, discovered)
return discovered
# adjacency list
graph = {
1: [2, 3, 4],
@201411108
201411108 / fix_exfat_drive.md
Created Apr 28, 2020 — forked from scottopell/fix_exfat_drive.md
Fix corrupted exFAT disk macOS/OSX
View fix_exfat_drive.md

exFAT support on macOS seems to have some bugs because my external drives with exFAT formatting will randomly get corrupted.

Disk Utility is unable to repair this at first, but the fix is this:

  1. Use diskutil list to find the right drive id.
  2. You want the id under the IDENTIFIER column, it should look like disk1s1
  3. Run sudo fsck_exfat -d <id from above>. eg sudo fsck_exfat -d disk1s3
  4. -d is debug so you'll see all your files output as they're processed.
  5. Answer YES if it gives you the prompt Main boot region needs to be updated. Yes/No?