Exemple #1
0
void Test(vector<T> &items, HashSet<T> &set)
{
	int count = 0;
	for (T& x :items)
	{
		++count;
		set.Insert(x);
	}
//	cout<<count<<endl;
//	cout<<set.GetLoadFactor()<<endl;
//	set.ForEach([](const T& t){cout<<t<<"-";});
//	cout << "count is :" << count << endl;

	cout << "Number of items: " << set.Size() << endl;
	cout << "Number of buckets: " << set.NumBuckets() << endl;
	cout << "Actual load factor: " << set.GetLoad() << endl;
	cout << "Max number of items in a bucket: " << set.MaxBucketSize() << endl;
	cout << "Percent of empty buckets: " << set.PercentEmptyBuckets() << endl;

//	set.DisplayItems();
//	set.Remove("Mike");
//	cout<<"remove one:------------"<<endl;
//	set.DisplayItems();
//	cout<<"max is:"<<set.MaxBucketSize()<<endl;
//	cout<<"clear:-----------------"<<endl;
//	set.Clear();
//	cout<<set.IsEmpty()<<endl;
//	set.DisplayItems();
//	set.DisplayBucket();
}
Exemple #2
0
void Test(vector<T> &items, HashSet<T> &set)
{
	for (T& x :items)
	{
        cout << x << endl;
		//set.Insert(x);
	}
	cout << "Number of items: " << set.Size() << endl;
	cout << "Number of buckets: " << set.NumBuckets() << endl;
	cout << "Actual load factor: " << set.GetLoad() << endl;
	cout << "Max number of items in a bucket: " << set.MaxBucketSize() << endl;
	cout << "Percent of empty buckets: " << set.PercentEmptyBuckets() << endl;
}