# Difference between HashTable, HashMap, HashSet & Hash what else you name it

 0 In CS101 we've learnt HashTable and it is the same paradigm with that python dictionary, right? if yes move on. So my question is simple: Seriously, there are how many Kind of Hash in this Hash Family? Hmm. actually I stumble upon this term after surfing around the web to find out more info on hash table. But struggle to understand the difference as their explanation not quite newbie-friendly. So what is the difference between HashTable vs HashMap vs HashSet vs (you may add it here any kind from Hash Family)? Thanks :) asked 04 Apr '12, 02:41 Yulianto 1.4k●3●15●64 accept rate: 52%

 2 First of all, hash means that you are implementing using a hash function of some kind that will give you a bucket index to find whatever you are looking for efficiently. That being said, hashtable is a table implemented with a hash function, hashmap is a map implemented this way, and likewise for hashset. A table, a map, and a set are just different data structures to store things. In general, a table is a collection of "records". You may think of a table in python as a list of lists (of lists,...). For example: [[studentname, phonenumber, birthdate, [friend1,friend2,...]...],...]. A map is collection of "key"-"value" pairs. Essentially we have a collection of mappings from keys to values, e.g. keywords to urls. A hashmap then is an efficient way to add/lookup keys and their corresponding values. I'm not certain, but I think the dictionary we used is a hashmap, not so much a hashtable (though similar). A set is just a collection of elements. In C++, a set would have to be a collection of elements of the same "type", such as integers, or strings, but not a mix. I'm not quite so sure there is a distinction for sets in Python, since we can just use lists to hold any type of element we want. Not aware of any other types of hash. Hope this helps! answered 04 Apr '12, 03:32 Stanley Xu 178●9 To add to the confusion, different languages call their own fancy name for hash maps, some call it dictionaries (wonder which one..), associative arrays, maps, hashmaps etc. Of course this is probably because they all have slightly different implementations, but conceptually they are same. (04 Apr '12, 03:43) fazal Sets are unordered collections with no respect for duplicates. This is true for both Python and C++ (in C++, you could use an std::vector just as well as you could use a list in Python). (04 Apr '12, 03:44) Anton Golov ♦ Good point about sets jesyspa. Except in C++ a vector is restricted to holding elements of the same data type, whereas a list can hold elements of any type! (04 Apr '12, 03:56) Stanley Xu The same restriction applies to std::set in C++. (04 Apr '12, 03:58) Anton Golov ♦
Question text:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "Title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported

×15,312
×33
×1
×1
×1