Hi,

On 09/24/2013 12:17 AM, David Christensen wrote:
> beginners:
>
>     H()      is the hash function

as you want the same hash of a substring regardless of the position, I
think you cannot make the hash dependent on the position of each
character in the string. A simple solution could be to add the number
value of each character. This would fullfill

H(string1 . string2) = H(string1) + H(string2)

I am not sure if the modulo operator also fulfils

(a % b) % c = (a % c) % (b % c)

In that case you could also use the modulo on your hash function.

>
>     string1  is a string
>
>     string2  is a string
>
>     .        is the string concatenation operator
>
>     f()      is a function
>
>     op       is a binary operator
>     
>
> Any suggestions?
>
>
> TIA,
>
> David
>
>


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to