|
|
back to boardProblem 'bout Hash.. (|8-1 I've seen a discussion that gave a Hash Function .... as this: x& 2^31 but As the writer say..the tests are too weak..got AC Is there any better Hash?...like ELF in string Hash.. touch me Please. Edited by author 21.10.2010 13:37 Re: Problem 'bout Hash.. (|8-1 Posted by KALO 21 Oct 2010 22:27 These should be better: string s; longint x:=0; for i:=1 to lenght(s) do x:=s[i]+(x shl 6) + (x shl 16) -x; or longint b:=3737 or b:=1717 x:=0; for i:=1 to length(s) do begin x:=x*b; x:=x+s[i]; end; Edited by author 21.10.2010 22:30 Edited by author 21.10.2010 22:33 Edited by author 21.10.2010 22:35 |
|
|