Say a, b, c are all List<t>
and I want to create an unsorted union of them. Although performance isn't super-critical, they might have 10,000 entries in each so I'm keen to avoid O(n^2) solutions.
AFAICT the MSDN documentation doesn't say anything about the performance characteristics of union as far as the different types are concerned.
My gut instinct says that if I just do a.Union(b).Union(c)
, this will take O(n^2) time, but new Hashset<t>(a).Union(b).Union(c)
would be O(n).
Does anyone have any documentation or metrics to confirm or deny this assumption?