gpt4 book ai didi

c# - 具有自定义 IEqualityComparer 的 Distinct() 方法的大 O

转载 作者:太空狗 更新时间:2023-10-30 00:46:28 24 4
gpt4 key购买 nike

有人知道 Distinct() 方法中使用的算法的大 O,带有自定义 IEqualityComparer 吗?

最佳答案

这里有一个关于“What guarantees are there on the run-time complexity (Big-O) of LINQ methods? ”的相同问题

请参阅有关 distinct 的答案中的这一部分:

Distinct, GroupBy Join, and I believe also the set-aggregation methods (Union, Intersect and Except) use hashing, so they should be close to O(N) instead of O(N²).

关于c# - 具有自定义 IEqualityComparer 的 Distinct() 方法的大 O,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3226663/

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