Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   A help needed in DATA Structures (http://www.go4expert.com/forums/help-data-structures-t21547/)

vignesh1988i 27Mar2010 18:05

A help needed in DATA Structures
 
good evening ,
i need a help from the people who all see this question... can anybody pl. give me the coding for a HASHING function (searching algorithm) in C??? :) i need that urgently... :)

thank you
S.R.Vignesh

xpi0t0s 28Mar2010 21:07

Re: A help needed in DATA Structures
 
http://en.wikipedia.org/wiki/Hash_function

teacher 28Mar2011 16:11

Re: A help needed in DATA Structures
 
[cpp]
unsigned xor_hash ( void *key, int len )
{
unsigned char *p = key;
unsigned h = 0;
int i;
for ( i = 0; i < len; i++ )
h ^= p[i];
return h;
}
[cpp]

here is another and better one
[cpp]
unsigned rot_hash ( void *key, int len )
{
unsigned char *p = key;
unsigned h = 0;
int i;

for ( i = 0; i < len; i++ )
h = ( h << 4 ) ^ ( h >> 28 ) ^ p[i];

return h;
}
[/cpp]

teacher 28Mar2011 16:12

Re: A help needed in DATA Structures
 
sorry for late reply.


All times are GMT +5.5. The time now is 10:42.