Data StructureheqpqPriority Queue

Priority Queue 優先權佇列

定義

當 pop() 時,會遵守:

  1. queue的特性:先進先出(first in, first out)
  2. 優先權 大/小 的優先 pop (max/min-priority queue)

用 Binary Heap 實作 Priority Queue

[Python] 使用 heapq

Last Updated on 2023/09/06 by A1go

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

目錄