首页
友链
关于

数据结构与算法 课堂笔记 7:二叉堆(Binary Heap)

04 / 03 / 2023 (最后编辑于 04 / 03 / 2023)
预计阅读时间 2 分钟

Defination

A non-empty binary tree is a min-heap if:

  1. The key associated with the root is less than or equal to the keys associated with either of the sub-trees (if any).
  2. Both of the sub-trees (if any) are also binary min-heaps.

Examples of Binary Heap:

  • Leftish Heap
  • Skew Heap

Operations

  1. top()
  2. pop()
  3. push()

Implementation