public DoubleHashTable(int size) { this.Size = PrimeList.GetNextPrime(size); this.HashPrime = PrimeList.GetNextPrime(this.Size); this.Storage = new HashTableItem <int> [this.Size]; this.Count = 0; }
public void PrimeListTest() { Assert.AreEqual(2, PrimeList.GetNextPrime(0), "Next prime after 0 is 2"); Assert.AreEqual(2, PrimeList.GetNextPrime(1), "Next prime after 1 is 2"); Assert.AreEqual(3, PrimeList.GetNextPrime(2), "Next prime after 2 is 3"); Assert.AreEqual(5, PrimeList.GetNextPrime(3), "Next prime after 3 is 5"); }
private void Rebuild() { this.Size = PrimeList.GetNextPrime(this.Size); var newStorageItems = new List <int>(); foreach (var item in this) { newStorageItems.Add(item); } this.Count = 0; this.Storage = new HashTableItem <int> [this.Size]; foreach (var item in newStorageItems) { this.Add(item); } }
public QuadraticHashTable(int size) { this.Size = PrimeList.GetNextPrime(size); this.Storage = new HashTableItem <int> [this.Size]; this.Count = 0; }