logoalt Hacker News

vintagedave12/08/20242 repliesview on HN

This is neat, and remarkably small. I personally need more comments in order to follow, say, the growth logic. I see it rehashes but I don't see how it doesn't potentially overwrite entries on the way.

Algorithm for hash collisions is just to find the next empty slot (linear probing)? What happens when the original entry is removed, are the ones in subsequent slots cycled backwards? I don't see that...

Also the name is new to me! TIL 'salmagundi' is an English word (not even a loan-word) for a type of salad made of many ingredients: an excellent name for a hash map that can contain many effectively random items.


Replies

e-dant12/08/2024

I like the exercise of trying to find the simplest reasonable solution to some problem.

Many of my toy and hobby projects are exactly that. Some make allowances for the sake of performance and generality.

The hash map, though, is up there with sorting algorithms in the breadth of wild implementations. Salmagundi is unlikely to be the fastest, or the smartest. But it’s cute and portable.

show 1 reply
andrelaszlo12/09/2024

The etymology of 'salmagundi' seems pretty obscure. It might be a loan word?

https://www.nytimes.com/1978/01/16/archives/the-salmagundi-d...

https://en.m.wiktionary.org/wiki/salmagundi