gpt4 book ai didi

java - 最大/最小堆树可以包含重复值吗?

转载 作者:太空狗 更新时间:2023-10-29 22:51:24 27 4
gpt4 key购买 nike

我想知道是否允许最大或最小堆树具有重复值?我试图仅通过在线资源查找与此相关的信息,但一直没有成功。

最佳答案

是的,他们可以。您可以在“算法简介”(Charles E. Leiserson、Clifford Stein、Thomas H. Cormen 和 Ronald Rivest 着)中阅读相关内容。根据维基百科中二叉堆的定义:

All nodes are either [greater than or equal to](max heaps) or [less than or equal to](min heaps) each of its children, according to a comparison predicate defined for the heap.

关于java - 最大/最小堆树可以包含重复值吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22570126/

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