**binary heap(이진 힙)**은 array에 저장된 완전 이진 트리로, **힙 속성(heap property)**을 유지합니다. min-heap에서는 모든 부모가 자식 이하이므로 최솟값이 항상 루트에 있습니다. 이것이 **priority queue(우선순위 큐)**의 표준 구현입니다.
array 레이아웃
text
1 index: 0 1 2 3 4
/ \ array: [1, 3, 5, 8, 4]
3 5 parent(i) = (i-1)//2
/ \ left(i) = 2i+1
8 4 right(i) = 2i+2
연산
python
heapq
h = []
heapq.heappush(h, )
heapq.heappush(h, )
heapq.heappush(h, )
smallest = h[]
heapq.heappop(h)
