큐(queue) : 선입선출(FIFO). 가장 먼저 삽입된 데이터가 가장 먼저 추출됨
pop
, push
import heapq
import heapq
arr = [1,4,2,3]
print(arr) # [1,4,2,3]
heapq.heapify(arr)
print(arr) # [1,3,2,4]
heap.heappush(heap, item)
heapq.heappush(hq,2) # 힙 원소 추가
heapq.heappush(hq,7)
heapq.heappush(hq,3)
heap.heappop(heap)
heap[0]
활용heapq.heappop(hq) # 2
https://velog.io/@mein-figur/Python%EC%9A%B0%EC%84%A0%EC%88%9C%EC%9C%84-%ED%81%90-heapq
https://greenring.tistory.com/36