Standard process_hashHASH

Standard process_hashHASH

#include<iostream>
#include<cstdio>
using namespace std;
int HASH(int x)
{
    
    
	return x%p;
}
int locate(int x)
{
    
    
	int i,w=HASH(x);
	for(i=0;i<s&&hash[(w+i)%p]!=0&&hash[(w+i)%p]!=x;i++);
	return (w+i)%p;
}
void insert(int x)
{
    
    
	int w=locate(x);
	if(w==0)
		hash[w]=x;
	return;
}
bool member(int x)
{
    
    
	return (hash[locate(x)]==x);
}
int main()
{
    
    
	return 0;
} 

Guess you like

Origin blog.csdn.net/weixin_46975572/article/details/115029746