Suryaamsh
BAN USERThis approach is different from conventional one, Thanks for it.
There is another limitation imposed on this approach.Assuming the prime numbers are generated before hand, the algorithm's reach is limited by the capacity of the datatype to store the multiplication. If there is an overflow during multiplication, surely the results are prone to error. I am not sure of the exact String-length that it can support if we use long long but I suppose it will not be very large, as the prime numbers grow at nearly exponential rate.
We can use constant space for hash implementation, using as much space as the domain of character of Strings. If they are represented using only 1 byte, we can use 2 ^ 8 size array, which is constant. Even if the character domain changes, we can allocate 2 ^ (8 * sizeof( character type)) and use general hash procedure, with hash function H(key) = key.
- Suryaamsh January 29, 2013
Yes. This works when you are permitted to modify linked list structure.
- Suryaamsh March 28, 2013