Heap 练习题
来源:互联网 发布:linux系统界面 编辑:程序博客网 时间:2024/06/05 07:29
Basic
find-max or find-min: find the maximum item of a max-heap or a minimum item of a min-heap (a.k.a. peek)
insert: adding a new key to the heap (a.k.a., push[1])
extract-min [or extract-max]: returns the node of minimum value from a min heap [or maximum value from a max heap] after removing it from the heap (a.k.a., pop[2])
delete-max or delete-min: removing the root node of a max- or min-heap, respectively
replace: pop root and push a new key. More efficient than pop followed by push, since only need to balance once, not twice, and appropriate for fixed-size heaps.[3]
Creation
create-heap: create an empty heap
heapify: create a heap out of given array of elements
merge (union): joining two heaps to form a valid new heap containing all the elements of both, preserving the original heaps.
meld: joining two heaps to form a valid new heap containing all the elements of both, destroying the original heaps.
Inspection
size: return the number of items in the heap.
is-empty: return true if the heap is empty, false otherwise – an optimized form of size when total size is not needed.
Internal
increase-key or decrease-key: updating a key within a max- or min-heap, respectively
delete: delete an arbitrary node (followed by moving last node and sifting to maintain heap)
sift-up: move a node up in the tree, as long as needed; used to restore heap condition after insertion. Called “sift” because node moves up the tree until it reaches the correct level, as in a sieve.
sift-down: move a node down in the tree, similar to sift-up; used to restore heap condition after deletion or replacement.
- Heap 练习题
- Heap
- Heap
- heap
- Heap
- heap
- heap
- heap
- Heap
- heap
- Heap
- heap
- heap
- heap
- heap
- Heap
- heap
- 练习题
- HTML5+jQuery制作温馨浪漫爱心表白动画特效
- Android开发--自定义控件实现listview的滑动删除item
- Windows驱动开发WDM (5)- DeviceIoControl(直接方式交互"输出buffer")
- java中hashCode的作用
- javascript_DOM 编程艺术学习笔记(一)
- Heap 练习题
- js Map封装
- 延迟执行
- Editplus个人喜好设置
- javaMail发送邮件,支持多人发送,多人收信,多附件等
- shell 实例收集
- Http网络请求
- Android开源BezierView:仿QQ未读消息99+条的红色气泡
- 【ZooKeeper】ZooKeeper原理及使用场景