标签归档:Algorithm

RSS feed of Algorithm

The Best Hash Algorithm : BKDRHash

// BKDR Hash Function
unsigned int BKDRHash(char *str)
{
    unsigned int seed = 131; // 31 131 1313 13131 131313 etc..
    unsigned int hash = 0;

    while (*str)
    {
        hash = hash * seed + (*str++);
    }

    return (hash & 0x7FFFFFFF);
}

本文链接:/2018/11/11/best-hash-function-algorithm-bkdrhash/
请尊重作者的劳动成果,转载请注明出处!Sakishum 博客保留对文章的所有权利。