Preliminary Hash

Brief introduction

\ (The Hash \) is a data structure stored in the chain, with \ (HD [] \) recorded in each state \ (the Hash \) the first position in the table, with \ (the Hash [] \) Record \ (Hash \) table.

Generally, \ (the Hash \) basic data structure comprises:

struct node
{
    int num[],next;
}hash[];
int cnt,hd[];

The main function

Calculation \ (the Hash \) function value

int GetHash(int *num)
{
    int Res=0;
    for(int i=1;i<=N;++i) Res+=num[i];
    return Res%Mod;
}

Guess you like

Origin www.cnblogs.com/hihocoder/p/12000690.html