public HashMultiset(MultisetAbstract <int> multiset, IHashFunction hashFunction, int k) { _hashFunction = hashFunction; _sortedSet = new List <List <BigInteger> >(); for (int i = 0; i < multiset.GetLength(); i += 1) { var m = multiset.GetMultiset(i); var temp = new List <BigInteger>(); m.ForEach(item => { var hash = hashFunction.GetHash(item); if ((temp.Count() < k && !temp.Any(x => x == hash) || (temp.Count() >= k && temp[k - 1] > hash))) { temp.Add(hash); if (temp.Count() - k > 100) { temp = temp.OrderBy(x => x).Take(k).ToList(); } } }); _sortedSet.Add(temp.OrderBy(x => x).Take(k).ToList()); } }
public HashMultiset(MultisetAbstract <int> multiset, IHashFunction hashFunction) : this(multiset, hashFunction, 400) { }