Difference between priority queue and a heap

后端 未结 5 1280
我在风中等你
我在风中等你 2021-01-30 16:38

It seems that a priority queue is just a heap with normal queue operations like insert, delete, top, etc. Is this the correct way to interpret a priority queue? I know you can b

5条回答
  •  庸人自扰
    2021-01-30 17:26

    The term priority queue refers to the general data structure useful to order priorities of its element. There are multiple ways to achieve that, e.g., various ordered tree structures (e.g., a splay tree works reasonably well) as well as various heaps, e.g., d-heaps or Fibonacci heaps. Conceptually, a heap is a tree structure where the weight of every node is not less than the weight of any node in the subtree routed at that node.

提交回复
热议问题