mirror of
https://github.com/krahets/hello-algo.git
synced 2026-09-01 04:47:12 +00:00
Polish the chapter
introduction, computational complexity.
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
|
||||
有趣的是,存在一种更高效的建堆方法,其时间复杂度可以达到 $O(n)$ 。我们先将列表所有元素原封不动添加到堆中,然后倒序遍历该堆,依次对每个节点执行“从顶至底堆化”。
|
||||
|
||||
请注意,因为叶节点没有子节点,所以无需堆化。在代码实现中,我们从最后一个节点的父节点开始进行堆化。
|
||||
请注意,因为叶节点没有子节点,所以无须堆化。在代码实现中,我们从最后一个节点的父节点开始进行堆化。
|
||||
|
||||
=== "Java"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user