Properties of a good hash function from MIT recitation :
Can some one explain the point 2 further . What does variable name has to do with hash functions ?
Edit : I work with Java . So if an answer contains explanation using java semantics it is okay to me .
Since hash tables are often used for building lookup tables that compilers use to look up information about symbols, such as variable names and function names, a compiler scenario is used to explain the point of #2.
The authors took a pair of variable names that are very commonly found in the same program, i
and j
, and said that strings representing the names of these variables, "i"
and "j"
, should not be hashed to the same slot. This makes sense, because resolving hash collisions is the part of the lookup process that most negatively influences the speed.
The bullet point suggests that compilers use something called a symbol table which is a mapping from variable name to information about that variable, implemented as a hash table.
Which is true of many compilers.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.