0x10基础数据结构-(4)-二叉堆

二叉堆

二叉堆(优先队列),是一颗满足"堆"性质的完全二叉树

手动实现,主要靠up 和 down操作。

大根堆

类内重载operator <,以实现less<T>less<T>函数

小根堆

类内重载operator >,以实现greater<T>greater<T>函数

应用:对顶堆求动态中位数

https://www.acwing.com/problem/content/108/