We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://hunterhug.github.io/goa.c/#/algorithm/heaps
The text was updated successfully, but these errors were encountered:
第 k 层的非叶子节点的数量为 n/2^k,每一个非叶子节点下沉的最大次数为其子孙的层数:k,而树的层数为 logn 层,那么总的翻转次数计算如下:
因为如下的公式是成立的:
所以翻转的次数计算结果为:2n 次。也就是构建堆的时间复杂度为:O(n)。
这个地方的公式和计算过程没有填上哦 @hunterhug
Sorry, something went wrong.
@lxc0916 第 k 层的非叶子节点的数量为 n/2^k,每一个非叶子节点下沉的最大次数为其子孙的层数:k,而树的层数为 logn 层,那么总的翻转次数计算如下: 因为如下的公式是成立的: 所以翻转的次数计算结果为:2n 次。也就是构建堆的时间复杂度为:O(n)。 这个地方的公式和计算过程没有填上哦 @hunterhug
@lxc0916 第 k 层的非叶子节点的数量为 n/2^k,每一个非叶子节点下沉的最大次数为其子孙的层数:k,而树的层数为 logn 层,那么总的翻转次数计算如下:
要看下高等数学,无穷级数部分
我利用最小堆实现了一个有过期时间的内存缓存,https://github.com/hunterhug/gocache/blob/master/README_ZH.md
代码可以借鉴。
No branches or pull requests
https://hunterhug.github.io/goa.c/#/algorithm/heaps
The text was updated successfully, but these errors were encountered: