[Cs3] Questions from class

Mikhail Nesterenko mikhail at cs.kent.edu
Fri Jun 27 13:59:30 EDT 2014


> 
> You wanted me to email you to remind you to research what effects the find
> function would have when invoked on a hash.

Okay, generic find() algorithm uses increment/decrement operators
which on an associative container may take log(n) time. This means
generic find() could take n*log(n) time.  However, associative
containers provide a member function find() that should be used.

> 
> I had a question of my own, as well.  You said in lecture that mapping
> different keys to the same bucket would possibly cause collision.  Is it
> possible to map the same key to a different bucket, and if so, what are
> some possible effects from doing so?

No, it is not possible. Hash function is designed such that the key
always maps to exactly the same bucket. This way the element can be
looked up once its the bucket it is in is found on the basis of key.

Thanks,
-- 
Mikhail


More information about the cs3 mailing list