二叉堆的代码实现
原创约 5772 字
The previous article Principles of Binary Heap introduced the basic properties, APIs, and common applications of binary heaps. In this article, we will use a visual panel to guide you step-by-step in implementing a priority queue.
First, we will implement a simplified version of a priority queue to help you understand the core operations of a binary heap, sink
and swim
. Finally, I will provide a more complete code implementation.