3 ms·
Depends on what exactly your company is doing? Why do you care if an applicant understand how a hash map works; and what's particular about a hash map? I'd car
by csomar 4y ago
Depends on what exactly your company is doing? Why do you care if an applicant understand how a hash map works; and what's particular about a hash map?
I'd care more about an applicant understanding the concept of a hash; or hashing in general. If an applicant shows that he understands that a hash is a magical and fascinating mathematical concept; and it can have uses in Information/Computers, that would be more interesting (to me) than someone who memorized a hash map definition.
He can always learn about a particular application of hashing (hash map, for example). But the latter shows aptitude and capacity to learn these later on the job.
- whimsicalism 4y agoTo me, "what a hashmap is" is just an extremely basic engineering concept. Your reference to "memorizing" (to refer to the topic you don't like) vs. "understanding" (to refer to the topic you do like) is value-laden and also suggests to me that you think a hashmap is more complicated than it actually is - it is truly just one step from understanding what a hash is.
- bryanrasmussen 4y agowell I mean there is quite a lot of differences between what the answer to 'what is a hashmap?' can be - is it acceptable to say a hashmap is a bunch of key value pairs where the key is an identifier by which you can look up the value you want - or should it be more in depth - akin to the wikipedia article https://en.wikipedia.org/wiki/Hash_table https://en.wikipedia.org/wiki/Hash_table describing not just what it is but also its place in CS and how it is implemented? If the second it's probable the memorized description would be accurate.
- whimsicalism 4y agoI would expect the basic notion of hashing to decide where to place an element as well as a strategy for dealing with collisions (the basic approach being hashing to a linked list). This didn't require any "memorization" on my part.
- bryanrasmussen 4y agoOk fine, so not an in-depth definition, but someone might think you mean an in-depth definition if you don't specify the level you expect is being used (perhaps because they have encountered that situation). I mean if you ask me define a hashmap and how it works for example I might think: "aw damn, this guy wants the low level details, I bet this place sucks to work at!" Although I would probably ask them to specify the level of detail they want before trying to comply, and then not get the job because I ask a lot of unnecessary questions or something.
- whimsicalism 4y agoI'm not sure what you even mean by an "in-depth definition." What I said is basically constitutive of a hashmap, it's place in the history of CS or whatever is not.
- bryanrasmussen 4y agoa not in-depth definition would be a 1 sentence definition of a hash map with probably give me an example of when you might want to use it. an in-depth definition would be that, followed by how you implement a hash map (thus if your language of choice already has a hash map, don't use that but show us how you would implement this classic data structure), how do you avoid collisions, maybe discuss some various ways that you could implement it and what the tradeoffs are. This would be you 'understand!!' what a hashmap is, like deeply. (I hope my tone makes clear I do not advocate for this) on edit: I think it seems you might actually be advocating for this deep definition? If so, probably you are working at relatively low level? on edit 2: for example if you were using Python you might say a hash map is a dict, and talk about how to use dict, the in-depth definition would not allow this. Which I think is what the other posters were worried about, being asked not to use your language's implementation of the concept but go lower and show you can make the whole thing.
- whimsicalism 4y agoI don't think understanding how a hash map, an incredibly simple data structure used frequently, is all that "low level." If I really wanted low level, I would talk about having linked lists of arrays rather than a linked list of nodes so that you could benefit from fewer random lookups. I work as an ML engineer, so very high level.
- chadash 4y ago> why do you care if an applicant understand how a hash map works; and what's particular about a hash map? Because a hash map is: 1) a pretty basic concept in data structures 2) Variations on hash maps are used all the time in the real world. If you use objects in javascript, dictionaries in python, or maps in C++, then you are using things that essentially implement hash maps. Point number 1 is like if I went to an orthopedic surgeon and they couldn't tell me what the liver does. You can say "well the liver has nothing to do with my finger that got smashed in a car crash, so what do I care." Or you can say, "that seems like a red flag. Maybe I'd be safer choosing a different doctor." * Note: I have no idea how often the liver comes up in orthopedic finger surgery and for all I know it's a lot. But I think you get the point.
- treis 4y ago>Variations on hash maps are used all the time Yes, you use them. You don't build them. To torture your analogy it's like asking the surgeon to explain how their bone saw works. Why should they know? All they care is that it cuts bone.
- chadash 4y agoKnowing how to build a bone saw is a completely different skill set than surgery. Building a hash table is a job for a software engineer even if not every engineer does it frequently. Still my analogy wasn’t great. Analogies aside, hashmaps (in one implementation or another), arrays, vectors/lists, strings and arguably sets are very very common data structures in most modern languages. I don’t expect someone to be able to build a hashmap from scratch but I do expect an experienced engineer to have some basic idea of the pieces that go into building it as well as it’s properties (not necessarily ordered, O(1)ish sets/gets, collisions, etc). Knowing this kind of thing helps you understand when to use an object in JavaScript vs a map. Or how dictionaries differ between python 2 and 3. If you understand the underlying data structure, then you know what questions to ask. * in python 2, a dictionary’s keys are not guaranteed to have consistent order. In more recent versions of python 3, they ARE guaranteed to have consistent ordering. This has ramifications for the code you write, and it’s especially confusing if you don’t understand hashmaps because 99% of the time, the order will be maintained in python 2 even though it isn’t guaranteed. But relying on things that are true most of the time is a very bad way to write production code :)