Anyone knows the Big O of the algorithm used in the Distinct()
method, with a custom IEqualityComparer
?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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:
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²).