gpt4 book ai didi

algorithm - n个元素堆不一致给定高度 'h'的节点数

转载 作者:塔克拉玛干 更新时间:2023-11-03 03:47:43 24 4
gpt4 key购买 nike

“n”个元素堆中高度“h”的节点数的公式为 ceil(n/2^(h+1))。对于这个给定的问题,如图所示高度为 2 的节点数为 2。 enter image description here

但是根据公式,我得到 ceil(19/8) = 3。

谁能帮我解释一下我的错误?

最佳答案

The formula for the number of nodes of height 'h' in an 'n' element heap is given as ceil(n/2^(h+1))

你能提供你的来源吗?

如果这是关于 this problem (我从你的照片中假设)。它说:

一个大小为n的堆有至多个ceil(n/2^(h+1))个高度为h的节点

关于algorithm - n个元素堆不一致给定高度 'h'的节点数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42567011/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com