Open utterances-bot opened 1 year ago
Great article!! I have question, since we are not using a function to generate an index, shouldn't we call it HashMap instead of HashTable?
Hey @josueadelima Josué thank you ❤️ In my mind, hashtable, hashmap, dict (in Python case), map (in Golang case), mapping are names for pretty much the same data structure. Do you see differences? Would interesting to learn more on that.
Hi, my thinking is that even if their purpose is the same (O(1) time access
), for the case of a HashTable
, you'll be using a function that generates an index
of an array (at least in ruby you don't have a library so you always implement this), for the case of hashmap
(hash
in ruby) or dict
(set
in ruby), I see them as part of the language, thats why I like to make a distinction between them. Even with hashmap
and set
, you have a difference, while one have key->value
, the other use only key
.
I found your article very useful, but is not strictly using a HashTable
, and to not confuse somebody learning, I thought it would be better to name it as hashmap
.
Design LRU Cache - Blog by Roman Glushko
Have fun designing least-recently-used cache in Python
https://www.romaglushko.com/blog/design-lru-cache/