带有自定义IEqualityComparer的Distinct()方法的Big O

编程入门 行业动态 更新时间:2024-10-27 16:37:48
本文介绍了带有自定义IEqualityComparer的Distinct()方法的Big O的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

任何人都知道使用自定义IEqualityComparer的Distinct()方法中使用的算法的大O吗?

Anyone knows the Big O of the algorithm used in the Distinct() method, with a custom IEqualityComparer?

推荐答案

SO上有一个关于" LINQ方法的运行时复杂度(Big-O)有什么保证?"

There's an equal question here on SO about "What guarantees are there on the run-time complexity (Big-O) of LINQ methods?"

请参阅答案中有关非重复的这一部分:

See this section in the answer about distinct:

与众不同,请加入,我相信 还有集合聚合方法 (联合,相交和除外)使用 散列,所以它们应该接近 O(N)代替O(N²).

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²).

更多推荐

带有自定义IEqualityComparer的Distinct()方法的Big O

本文发布于:2023-11-30 05:53:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1648935.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:自定义   方法   Distinct   IEqualityComparer   Big

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!