3 ms·
Why using a good or better hash table, when you can implement the worst by yourself? OMG
by rurban 3y ago
Why using a good or better hash table, when you can implement the worst by yourself? OMG
- zokier 3y ago> Solving it helped me gain better intuition around hash functions, pointers, and memory segments like the stack and the heap.
- naillo 3y agoWell these things are what everyone has to do in college anyway because it's helpful for training you. And if you didn't get to do that in your algo courses or you didn't do college or haven't done it yet then articles like this are super useful.
- detrites 3y agoCan you at least list some good or better hash tables?
- rurban 3y agosearch for htable or hashtable in thousands of open source projects. only a minority has worse hashtables than this one (clisp, perl5 e.g.). For better ones I would point to my linked list implementation: https://github.com/rurban/ctl/blob/master/ctl/unordered_set.h https://github.com/rurban/ctl/blob/master/ctl/unordered_set.... (because it has various security policies, nobody else has) or https://github.com/LIMachi/swiss-table https://github.com/LIMachi/swiss-table (all in C)
- tialaramex 3y agoHaving Swiss Tables (a more or less state of the art hash table for modern computers) is attractive but I think it'd be appropriate to be scared of unmaintained C labelled as a "proof of concept". The CTL "unordered set" is roughly the same bad design as its namesake in C++, presumably on purpose. We really shouldn't be teaching new users this bad structure, nor the "security policy" mitigations it provides. And by the way it's not a "distributed" denial of service when somebody plugs 128 colliding values into your API, just a normal trivial DOS.