1、 hlisti.py= hlisti.k=0; hlisti.si=0; ; for (i=0;N; sum=0; adr=(oldlisti.k)%M; d=adr; if(hlistadr.si=0) hlistadr.k=oldlisti.k; hlistadr.name=oldlisti.name; hlistadr.py=oldlisti.py; hlistadr.si=1; else do d=(d+(oldlisti.k)%10+1)%M;/*伪随机*/ sum=sum+1; while (hlistd.k!=0); hlistd.k=oldlisti.k; hlistd.nam
2、e=oldlisti.name; hlistd.py=oldlisti.py; hlistd.si=sum+1;/*/void findhlist() int s0;char r,g; clrscr();/*清屏*/ for (r=0;rL)LON=L;哈希表: gotoxy(1,2);地址: for(i=0;LON; gotoxy(1,i+3);%-3d,i); gotoxy(9,2);关键字: gotoxy(10,i+3);%-6d,hlisti.k); gotoxy(19,2);姓名: gotoxy(19,3+i);,hlisti.name); gotoxy(28,2);拼音: goto
3、xy(28,i+3);,hlisti.py); gotoxy(40,2);搜索长度: gotoxy(43,i+3);%2d,hlisti.si); gotoxy(53,2);H(key): gotoxy(53,i+3);,(hlisti.k)%M); average=0; average=average+hlisti.si; average=average/N; gotoxy(10,23);平均搜索长度:ASL(%d)=%f,N,average); gotoxy(20,24);任意键下一屏! ch1=getch(); if (L15)L-15)LON=L-15;,i+15);,hlisti+1
4、5.k);,hlisti+15.name);,hlisti+15.py);,hlisti+15.si);,(hlisti+15.k)%M);30)L-30)LON=L-30;,i+30);,hlisti+30.k);,hlisti+30.name);,hlisti+30.py);,hlisti+30.si);,(hlisti+30.k)%M);45)L-45)LON=L-45;,i+45);,hlisti+45.k);,hlisti+45.name);,hlisti+45.py);,hlisti+45.si);,(hlisti+45.k)%M);任意键返回!/*/void main() inp
5、(); /*输入原表*/ chash ();/*建哈希表*/a: gotoxy(21,2); textcolor(GREEN); cprintf(欢迎使用本程序-编者:n gotoxy(22, 4); 1.显示哈希表 gotoxy(22, 6); 2.查找 gotoxy(22, 8); x.退出 gotoxy(22, 12);请输入选择: gotoxy(24,14); if (ch1=0x78) textcolor(GREEN);谢谢使用本程序,你已经退出本程序! exit();/*x:退出*/ if (ch1=0x31)dhash();/*表的属性*/ if (ch1=0x32) findhlist();/*查找*/ goto a;
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1