文件名称:Hashtable
-
所属分类:
- 标签属性:
- 上传时间:2012-11-16
-
文件大小:1.28kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
哈希表:
HashTable H int s,a,n,w,i,q,t g=1
cout<<"输入元素个数n:\n"
cin>>n
InitList_H(H)
for(i=0 i<16 i++)
H.elem[i]=10000
for(i=0 i<n i++)
{cout<<"输入你要输入的n个数:\n"
cin>>s t=1
H.count++
if(H.elem[s 13]==10000)
H.elem[s 13]=s
else{
while(H.elem[(s 13+t) 16]!=10000)t++
H.elem[(s 13+t) 16]=s }
}
cout<<"输入你要查找数:\n"
cin>>w
a=SearchHash(H,w)
if(a){if(a==200)cout<<"查找成功! :"<<H.elem[0]<<endl else cout<<"查找成功! :"<<H.elem[a]<<endl }
else { q=InsertHash(H,w) cout<<q<<"已插入!\n" }
for(i=0 i<16 i++)
{cout<<H.elem[i]<<" " }//if((i+1) 11==0)cout<<endl }
cout<<endl
return 0
}-Hash table: HashTable H int s, a, n, w, i, q, t g = 1 cout < < " Enter the number of elements n: \ n" cin> > n InitList_H (H) for (i = 0 i < 16 i++) H.elem [i] = 10000 for (i = 0 i <n i++)
{cout<<"输入你要输入的n个数:\n"
cin> > S t = 1 H.count++ if (H.elem [s 13] == 10000) H.elem [s 13] = s else (while (H.elem [(s 13+ t ) 16]! = 10000) t++ H.elem [(s 13+ t) 16] = s )) cout < < " Enter the number you want to find: \ n" cin> > w a = SearchHash (H, w) if (a) (if (a == 200) cout < < " find success!:" < <H.elem[0]<<endl else cout<<"查找成功! :"<<H.elem[a]<<endl }
else { q=InsertHash(H,w) cout<<q<<"已插入!\n" }
for(i=0 i<16 i++)
{cout<<H.elem[i]<<" " }//if((i+1) 11==0)cout<<endl }
cout<<endl
return 0
}
HashTable H int s,a,n,w,i,q,t g=1
cout<<"输入元素个数n:\n"
cin>>n
InitList_H(H)
for(i=0 i<16 i++)
H.elem[i]=10000
for(i=0 i<n i++)
{cout<<"输入你要输入的n个数:\n"
cin>>s t=1
H.count++
if(H.elem[s 13]==10000)
H.elem[s 13]=s
else{
while(H.elem[(s 13+t) 16]!=10000)t++
H.elem[(s 13+t) 16]=s }
}
cout<<"输入你要查找数:\n"
cin>>w
a=SearchHash(H,w)
if(a){if(a==200)cout<<"查找成功! :"<<H.elem[0]<<endl else cout<<"查找成功! :"<<H.elem[a]<<endl }
else { q=InsertHash(H,w) cout<<q<<"已插入!\n" }
for(i=0 i<16 i++)
{cout<<H.elem[i]<<" " }//if((i+1) 11==0)cout<<endl }
cout<<endl
return 0
}-Hash table: HashTable H int s, a, n, w, i, q, t g = 1 cout < < " Enter the number of elements n: \ n" cin> > n InitList_H (H) for (i = 0 i < 16 i++) H.elem [i] = 10000 for (i = 0 i <n i++)
{cout<<"输入你要输入的n个数:\n"
cin> > S t = 1 H.count++ if (H.elem [s 13] == 10000) H.elem [s 13] = s else (while (H.elem [(s 13+ t ) 16]! = 10000) t++ H.elem [(s 13+ t) 16] = s )) cout < < " Enter the number you want to find: \ n" cin> > w a = SearchHash (H, w) if (a) (if (a == 200) cout < < " find success!:" < <H.elem[0]<<endl else cout<<"查找成功! :"<<H.elem[a]<<endl }
else { q=InsertHash(H,w) cout<<q<<"已插入!\n" }
for(i=0 i<16 i++)
{cout<<H.elem[i]<<" " }//if((i+1) 11==0)cout<<endl }
cout<<endl
return 0
}
(系统自动生成,下载前可以参看下载内容)
下载文件列表
Hashtable.txt
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.