in the Microsoft documentation, the complexity is indicated as O(n)
but if you look at the implementation
foreach (T item in other)
{
if (Contains(item))
{
return true;
}
}
, then the search method is called for each element, which gives the complexity O(m*log(n))
who is really right?
This is mistake in the docs, if you check docs for
Contains(and it's implementation usingFindNode) you will see:Which makes
Overlapsto beO(n log m)wherem- number of elements in the "this" collection andnis the number of elements inother.Created PR for the docs.
UPD
PR was merged and now docs say: