Добавить u7/hash_table.py
This commit is contained in:
parent
83e049b6c6
commit
71fa3e70a5
16
u7/hash_table.py
Normal file
16
u7/hash_table.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
class HashTable:
|
||||||
|
_DELETED = object()
|
||||||
|
|
||||||
|
def __init__(self, capacity=10):
|
||||||
|
if type(capacity) != int:
|
||||||
|
raise TypeError("Capacity must be an integer")
|
||||||
|
if capacity <= 0:
|
||||||
|
raise ValueError("Capacity must be positive")
|
||||||
|
|
||||||
|
self._capacity = capacity
|
||||||
|
self._table = [None] * capacity
|
||||||
|
self._size = 0
|
||||||
|
|
||||||
|
@property
|
||||||
|
def capacity(self):
|
||||||
|
return self._capacity
|
||||||
Loading…
Reference in New Issue
Block a user