Recent posts

prim, dijkstra

1 minute read

```py def prim(s, V): result = 0 mst = [0] * (V + 1) mst[s] = 1

조합, 중복조합, 중복순열

less than 1 minute read

조합 def combi(arr, r): for i in range(len(arr)): if r == 1: yield [arr[i]] else: for next in combi(arr[i + 1:], r ...

최대 힙, 최소 힙

1 minute read

최대 힙 ```py def enq(v): global last last += 1 arr[last] = v c = last p = c // 2 while p >= 1 and arr[p] < arr[c]: arr[p]...

퀵 정렬(quick sort)

less than 1 minute read

```py def partitionH(start, end): pivot = start lp = start + 1 rp = end while lp <= rp: while lp <= end and arr[pivot] >= ar...