simple hash ?
can you specify the hashing function because if we use stl's map its
complexity is O(log(n))
On Thu, Nov 3, 2011 at 1:48 AM, Robert Badita robert.bad...@gmail.comwrote:
Simple hash will do it in O(1) but with careful implementation of
getRandomElement to distribute probability
The hash function is the middle n bits of x * scramble, choosing the lowest n
bits has bad hasing properties
On Nov 3, 2011, at 1:59 PM, Robert Badita robert.bad...@gmail.com wrote:
What you need is to recreate the hash, and make your own hash structure like
an array with 2^n elements where
What you need is to recreate the hash, and make your own hash structure like an
array with 2^n elements where 0.9 * 2^n = N where N is the number of real
elements in your structure (use 90% maximum fill factor)
If you use the hash as a dynamic vector with minimum 10% fill factor and max
90%
does anyone knows how much is the complexity of operations erase and
pop_back in case of Vector(STL)
what would you choose :
Design a data structure where the following 3 functions are optimised:
1. Insert(n)
2. GetRandomElement()
3. Remove(n)
Write a class, and implement the functions. Give
Simple hash will do it in O(1) but with careful implementation of
getRandomElement to distribute probability evenly to each bucket / element in
the bucket
On Nov 2, 2011, at 5:52 PM, shady sinv...@gmail.com wrote:
does anyone knows how much is the complexity of operations erase and pop_back