3 ms·
well 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 val
by bryanrasmussen 4y ago
well 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.
- bryanrasmussen 4y agoOk, perhaps for your job it is reasonable to know what I call the in-depth definition - implement hash map functionality in language interview is using without using built in hash map functionality of language, discuss trade-offs (or perhaps it is your particular interests that allows you to keep this information readily available) but I guess you can see how many people's jobs do not require this and it would be reasonable for job interviews in those fields to only want the shallow understanding - one line definition of hash map, when would you use it. If you ask for the in-depth understanding for positions that would never need it, it follows that you will be disadvantaging many applicants who might be great for the position and advantaging applicants who know at least one non-relevant thing.