private int _sizeIndex = 0; // определяет индекс элемента из массива размеров таблицы public OpenAddressHashTable(int size) { table = new Pair <TKey, TValue> [size]; _capacity = size; _hashMaker1 = new HashMaker <TKey>(_capacity); _hashMaker2 = new HashMaker <TKey>(_capacity - 1); Count = 0; }
public OpenAddressHashTable() { int size = _sizes[_sizeIndex]; _capacity = size; table = new Pair <TKey, TValue> [size]; _hashMaker1 = new HashMaker <TKey>(_capacity); _hashMaker2 = new HashMaker <TKey>(_capacity - 1); Count = 0; }
private void IncreaseTable() { _sizeIndex++; int size = _sizes[_sizeIndex]; _capacity = size; _hashMaker1 = new HashMaker <TKey>(_capacity); _hashMaker2 = new HashMaker <TKey>(_capacity - 1); Count = 0; Pair <TKey, TValue>[] buffer = table; table = new Pair <TKey, TValue> [size]; foreach (var el in buffer) { if (el != null) { Add(el.Key, el.Value); } } }