1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

A help needed in DATA Structures

Discussion in 'C' started by vignesh1988i, Mar 27, 2010.

  1. vignesh1988i

    vignesh1988i Banned

    Joined:
    Sep 19, 2009
    Messages:
    72
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Chennai
    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
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
  3. teacher

    teacher New Member

    Joined:
    Mar 27, 2011
    Messages:
    66
    Likes Received:
    8
    Trophy Points:
    0
    Occupation:
    i hate jobs
    Location:
    india,agra
    Home Page:
    [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;
    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;

    return h;
    }
    [/cpp]
     
  4. teacher

    teacher New Member

    Joined:
    Mar 27, 2011
    Messages:
    66
    Likes Received:
    8
    Trophy Points:
    0
    Occupation:
    i hate jobs
    Location:
    india,agra
    Home Page:
    sorry for late reply.
     

Share This Page