Hash Table implementation in Python

Publicado el: 17 octubre 2022
en el canal de: Python Developer
5
0

class HashTable:
def __init__(self):
self.MAX = 10
self.arr = [None for i in range(self.MAX)]

def get_hash(self,key):
hash = 0
for char in key:
hash += ord(char)
return hash % self.MAX

def __getitem__(self, index):
h = self.get_hash(index)
return self.arr[h]

def __setitem__(self, key, value):
h = self.get_hash(key)
self.arr[h] = value
JamBoard
https://jamboard.google.com/d/14zl1_v...

GIST Link
https://gist.github.com/divey-learnin...


En esta página del sitio puede ver el video en línea Hash Table implementation in Python de Duración hora minuto segunda en buena calidad , que subió el usuario Python Developer 17 octubre 2022, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 5 veces y le gustó 0 a los espectadores. Disfruta viendo!