Google Interview Question
Software Engineer / DevelopersHashing essentially is a many to one mapping relation - that reduces the domain set [possibly of infinite cardinality] to a finite manageable range set.
Not always it reduces the range to finite - but restrict them in some way - by removing the some axis of freedom. So, mathematically hashing is an onto mapping from a set Domain "D" to a set range "R" - where |R|<< |D| "<<" is very less than.
Depending on what kind of hash table [read chaining] you are using - the maximum time would be different. In general worst case - it is length of the table.
Min is fixed and it is 1.
hashing for web based apps may be used in many areas.. afew that come to my mind are to do with security...
- anon May 08, 2009if u download a a chunk of data, its good practice to calculate its md5 hash and verify it with its precalculated correct md5 signature.
hashing is also used for password security
hashing can be used to maintain a hash of a previously fetched web page in browser caches and periodically the web page is retrieved and hashed if it has changed