We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 21f85af commit f103a45Copy full SHA for f103a45
data_structures/hashing/hash_map.py
@@ -253,6 +253,20 @@ def __getitem__(self, key: KEY) -> VAL:
253
raise KeyError(key)
254
255
def __len__(self) -> int:
256
+ """
257
+ Returns the number of items present in hashmap
258
+
259
+ >>> hm = HashMap(5)
260
+ >>> hm._add_item(1, 10)
261
+ >>> hm._add_item(2, 20)
262
+ >>> hm._add_item(3, 30)
263
+ >>> hm.__len__()
264
+ 3
265
266
267
268
+ 0
269
270
return self._len
271
272
def __iter__(self) -> Iterator[KEY]:
0 commit comments