我收藏了 int
我用来填充 HashSet<int>
的值按照以下方式-
var hashSet = new HashSet<int>(myIEnumerable);
假设迭代 IEnumerable
是O(n)
,创建 HashSet<int>
的最坏情况复杂度是多少?以这种方式?
最佳答案
文档实际上指出:
This constructor is an O(n) operation, where n is the number of elements in the collection parameter.
关于c# - 从集合创建 HashSet<int> 的最坏情况复杂度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14071591/