5 ms·
When I was an undergraduate my university used a test of ‘can you implement a hash table in C’ as their basic ‘can you really program’ test to stream incoming s
by chrisseaton 5y ago
When I was an undergraduate my university used a test of ‘can you implement a hash table in C’ as their basic ‘can you really program’ test to stream incoming students.
- whimsicalism 5y agoI think I'd have trouble with the hashing function but unless you're using a basic modulo.
- cle 5y agoIMO this is the least interesting part of a question like "can you write a hash table", unless you're in an area where writing hash functions is a critical skill. You have to deal with collisions either way...the ideal solution for me testing someone's software engineering skills would be one that uses a crappy hash function, but can trivially swap it out for something better. (Maybe this is different than what a school is testing for though?)
- vidarh 5y agoI agree. If I gave a test like that and someone gave me an answer where the hash function was pretty much just a dummy I'd be fine with that as long as they were clearly aware it was just a dummy and hopefully could explain roughly the characteristics of a good hash function.
- DudeInBasement 5y agosearch_index = value & ((hash_length_power_of2) - 1)
- Swizec 5y agoBack then that was likely true. Just like building linked lists from scratch was on the same level as writing a basic loop nowadays High level programming languages have come a long way in the past 20 years. So many things we no longer need to think about in normal day to day programming
- chrisseaton 5y agoYou can also build a hash table from scratch in for example Ruby. The language doesn’t matter and C isn’t the key bit of the problem.
- marginalia_nu 5y agoDunno, I've had use from knowing how to implement hash tables several times just in the last few months. Extremely useful stuff if you are working with memory mapped data that is larger than system memory.
- Swizec 5y agoOf course it’s useful. My argument is that it’s no longer necessary for most programmers. Almost every language now comes with a native good enough hash table implementation.
- yakubin 5y agoIt's necessary when you need to debug something, regardless of who wrote the implementation, now it's you're responsibility.
- pjmlp 5y agoIf they want to be allowed to write Engineer so-and-so, yes it is necessary.
- Swizec 5y agoJust like you had to learn how to code with absolute memory addressing because only a silly non-engineer would waste computer resources on a compiler, right?
- formerly_proven 5y agoThat's why it's called a computer science degree, not a gluing-libraries-together degree.