⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hash_usenix.ps

📁 这是我用QT和TTS写的一个电话本管理系统
💻 PS
📖 第 1 页 / 共 5 页
字号:
2418 1651(hsearch)N1 f2708(constructs)X3069(a)X3141(\256xed-size)X3489(hash)X3671(table)X3862(\(speci\256ed)X2418 1739(by)N2519(the)X2637(user)X2791(at)X2869(table)X3045(creation\).)X3391(By)X3504(default,)X3767(a)X3823(multiplica-)X2418 1827(tive)N2570(hash)X2748(function)X3046(based)X3260(on)X3371(that)X3522(described)X3861(in)X3954(Knuth,)X2418 1915(Volume)N2710(3,)X2804(section)X3065(6.4)X3199([KNU68])X3541(is)X3628(used)X3809(to)X3905(obtain)X4138(a)X2418 2003(primary)N2694(bucket)X2930(address.)X3233(If)X3309(this)X3446(bucket)X3681(is)X3755(full,)X3907(a)X3964(secon-)X2418 2091(dary)N2593(multiplicative)X3069(hash)X3248(value)X3454(is)X3538(computed)X3885(to)X3978(de\256ne)X2418 2179(the)N2542(probe)X2751(interval.)X3062(The)X3213(probe)X3422(interval)X3693(is)X3772(added)X3989(to)X4076(the)X2418 2267(original)N2712(bucket)X2971(address)X3257(\(modulo)X3573(the)X3716(table)X3916(size\))X4112(to)X2418 2355(obtain)N2658(a)X2734(new)X2908(bucket)X3162(address.)X3483(This)X3665(process)X3946(repeats)X2418 2443(until)N2588(an)X2688(empty)X2911(bucket)X3148(is)X3224(found.)X3474(If)X3551(no)X3654(bucket)X3891(is)X3967(found,)X2418 2531(an)N2514(insertion)X2814(fails)X2972(with)X3134(a)X3190(``table)X3420(full'')X3605(condition.)X2590 2645(The)N2768(basic)X2986(algorithm)X3350(may)X3541(be)X3670(modi\256ed)X4006(by)X4138(a)X2418 2733(number)N2705(of)X2813(compile)X3112(time)X3295(options)X3571(available)X3902(to)X4005(those)X2418 2821(users)N2604(with)X2767(AT&T)X3006(source)X3237(code.)X3450(First,)X3637(the)X3756(package)X4040(pro-)X2418 2909(vides)N2638(two)X2809(options)X3094(for)X3238(hash)X3435(functions.)X3803(Users)X4036(may)X2418 2997(specify)N2690(their)X2877(own)X3055(hash)X3242(function)X3549(by)X3669(compiling)X4032(with)X2418 3085(``USCR'')N2757(de\256ned)X3016(and)X3155(declaring)X3477(and)X3616(de\256ning)X3901(the)X4022(vari-)X2418 3173(able)N2 f2578(hcompar)X1 f2863(,)X2909(a)X2971(function)X3263(taking)X3488(two)X3633(string)X3840(arguments)X2418 3261(and)N2560(returning)X2880(an)X2982(integer.)X3271(Users)X3480(may)X3643(also)X3797(request)X4054(that)X2418 3349(hash)N2587(values)X2814(be)X2912(computed)X3250(simply)X3489(by)X3590(taking)X3811(the)X3930(modulo)X2418 3437(of)N2521(key)X2673(\(using)X2909(division)X3201(rather)X3424(than)X3597(multiplication)X4080(for)X2418 3525(hash)N2589(value)X2787(calculation\).)X3230(If)X3308(this)X3447(technique)X3783(is)X3859(used,)X4049(col-)X2418 3613(lisions)N2651(are)X2775(resolved)X3072(by)X3176(scanning)X3485(sequentially)X3896(from)X4076(the)X2418 3701(selected)N2702(bucket)X2941(\(linear)X3176(probing\).)X3517(This)X3684(option)X3913(is)X3991(avail-)X2418 3789(able)N2572(by)X2672(de\256ning)X2954(the)X3072(variable)X3351(``DIV'')X3622(at)X3700(compile)X3978(time.)X2590 3903(A)N2720(second)X3015(option,)X3311(based)X3565(on)X3716(an)X3863(algorithm)X2418 3991(discovered)N2787(by)X2888(Richard)X3163(P.)X3248(Brent,)X3466(rearranges)X3822(the)X3940(table)X4116(at)X2418 4079(the)N2549(time)X2724(of)X2824(insertion)X3137(in)X3232(order)X3434(to)X3528(speed)X3743(up)X3855(retrievals.)X2418 4167(The)N2571(basic)X2764(idea)X2926(is)X3007(to)X3097(shorten)X3361(long)X3531(probe)X3741(sequences)X4094(by)X2418 4255(lengthening)N2833(short)X3030(probe)X3249(sequences.)X3651(Once)X3857(the)X3991(probe)X2418 4343(chain)N2613(has)X2741(exceeded)X3062(some)X3252(threshold)X3571(\(Brent)X3796(suggests)X4087(2\),)X2418 4431(we)N2541(attempt)X2809(to)X2899(shuf\257e)X3145(any)X3289(colliding)X3601(keys)X3776(\(keys)X3978(which)X2418 4519(appeared)N2734(in)X2821(the)X2944(probe)X3152(sequence)X3471(of)X3562(the)X3684(new)X3842(key\).)X4049(The)X2418 4607(details)N2652(of)X2744(this)X2884(key)X3025(shuf\257ing)X3333(can)X3469(be)X3569(found)X3780(in)X3866([KNU68])X2418 4695(and)N2576([BRE73].)X2946(This)X3129(algorithm)X3481(may)X3660(be)X3777(obtained)X4094(by)X2418 4783(de\256ning)N2700(the)X2818(variable)X3097(``BRENT'')X3487(at)X3565(compile)X3843(time.)X2590 4897(A)N2698(third)X2899(set)X3038(of)X3154(options,)X3458(obtained)X3783(by)X3912(de\256ning)X2418 4985(``CHAINED'',)N2943(use)X3086(linked)X3321(lists)X3484(to)X3581(resolve)X3848(collisions.)X2418 5073(Either)N2647(of)X2747(the)X2878(primary)X3164(hash)X3343(function)X3642(described)X3982(above)X2418 5161(may)N2584(be)X2688(used,)X2882(but)X3011(all)X3118(collisions)X3451(are)X3577(resolved)X3876(by)X3983(build-)X2418 5249(ing)N2554(a)X2623(linked)X2856(list)X2986(of)X3086(entries)X3333(from)X3522(the)X3653(primary)X3940(bucket.)X2418 5337(By)N2542(default,)X2816(new)X2981(entries)X3226(will)X3381(be)X3488(added)X3711(to)X3804(a)X3871(bucket)X4116(at)X2418 5425(the)N2541(beginning)X2886(of)X2978(the)X3101(bucket)X3339(chain.)X3577(However,)X3916(compile)X2418 5513(options)N2706(``SORTUP'')X3173(or)X3293(``SORTDOWN'')X3908(may)X4098(be)X2418 5601(speci\256ed)N2723(to)X2805(order)X2995(the)X3113(hash)X3280(chains)X3505(within)X3729(each)X3897(bucket.)X3 f432 5960(4)N2970(USENIX)X9 f3292(-)X3 f3356(Winter)X3621('91)X9 f3748(-)X3 f3812(Dallas,)X4065(TX)X5 p%%Page: 5 50(Courier)xf 0 f10 s 10 xH 0 xS 0 f3 f720 258(Seltzer)N977(&)X1064(Yigit)X3278(A)X3356(New)X3528(Hashing)X3831(Package)X4136(for)X4259(UNIX)X2 f1444 538(dynahash)N1 f892 670(The)N2 f1054(dynahash)X1 f1398(library,)X1669(written)X1932(by)X2048(Esmond)X2346(Pitt,)X720 758(implements)N1183(Larson's)X1554(linear)X1827(hashing)X2165(algorithm)X720 846([LAR88])N1097(with)X1302(an)X2 f1440(hsearch)X1 f1756(compatible)X2174(interface.)X720 934(Intuitively,)N1099(a)X1161(hash)X1334(table)X1516(begins)X1751(as)X1844(a)X1905(single)X2121(bucket)X2360(and)X720 1022(grows)N941(in)X1028(generations,)X1443(where)X1665(a)X1725(generation)X2088(corresponds)X720 1110(to)N815(a)X884(doubling)X1201(in)X1296(the)X1427(size)X1585(of)X1685(the)X1815(hash)X1994(table.)X2222(The)X2379(0)X2 f7 s1078(th)Y10 s1 f720 1198(generation)N1085(occurs)X1321(as)X1414(the)X1538(table)X1719(grows)X1940(from)X2121(one)X2262(bucket)X720 1286(to)N814(two.)X1006(In)X1105(the)X1235(next)X1405(generation)X1776(the)X1906(table)X2093(grows)X2320(from)X720 1374(two)N862(to)X946(four.)X1122(During)X1371(each)X1541(generation,)X1921(every)X2121(bucket)X2356(that)X720 1462(existed)N967(at)X1045(the)X1163(beginning)X1503(of)X1590(the)X1708(generation)X2067(is)X2140(split.)X892 1576(The)N1041(table)X1221(starts)X1414(as)X1505(a)X1565(single)X1780(bucket)X2018(\(numbered)X2389(0\),)X720 1664(the)N839(current)X1088(split)X1245(bucket)X1479(is)X1552(set)X1661(to)X1743(bucket)X1977(0,)X2057(and)X2193(the)X2311(max-)X720 1752(imum)N933(split)X1097(point)X1288(is)X1368(set)X1483(to)X1571(twice)X1771(the)X1895(current)X2149(split)X2312(point)X720 1840(\(0\).)N863(When)X1084(it)X1157(is)X1239(time)X1410(for)X1532(a)X1596(bucket)X1838(to)X1928(split,)X2113(the)X2239(keys)X2414(in)X720 1928(the)N872(current)X1154(split)X1345(bucket)X1612(are)X1764(divided)X2057(between)X2378(the)X720 2016(current)N981(split)X1151(bucket)X1397(and)X1545(a)X1613(new)X1779(bucket)X2025(whose)X2262(bucket)X720 2104(number)N1000(is)X1088(equal)X1297(to)X1394(1)X1469(+)X1549(current)X1812(split)X1984(bucket)X2232(+)X2311(max-)X720 2192(imum)N927(split)X1085(point.)X1310(We)X1442(can)X1574(determine)X1915(which)X2131(keys)X2298(move)X720 2280(to)N807(the)X929(new)X1087(bucket)X1325(by)X1429(examining)X1791(the)X2 f1913(n)X7 s1962 2248(th)N10 s1 f2043 2280(bit)N2151(of)X2242(a)X2302(key's)X720 2368(hash)N899(value)X1105(where)X1334(n)X1406(is)X1491(the)X1620(generation)X1990(number.)X2306(After)X720 2456(the)N846(bucket)X1088(at)X1174(the)X1300(maximum)X1651(split)X1815(point)X2006(has)X2140(been)X2319(split,)X720 2544(the)N839(generation)X1198(number)X1463(is)X1536(incremented,)X1973(the)X2091(current)X2339(split)X720 2632(point)N908(is)X985(set)X1098(back)X1274(to)X1360(zero,)X1543(and)X1683(the)X1805(maximum)X2152(split)X2312(point)X720 2720(is)N815(set)X946(to)X1050(the)X1190(number)X1477(of)X1586(the)X1725(last)X1877(bucket)X2132(in)X2235(the)X2374(\256le)X720 2808(\(which)N971(is)X1052(equal)X1253(to)X1342(twice)X1543(the)X1668(old)X1797(maximum)X2148(split)X2312(point)X720 2896(plus)N873(1\).)X892 3010(To)N1031(facilitate)X1361(locating)X1668(keys,)X1884(we)X2027(maintain)X2356(two)X720 3098(masks.)N989(The)X1143(low)X1291(mask)X1488(is)X1569(equal)X1771(to)X1861(the)X1987(maximum)X2339(split)X720 3186(bucket)N967(and)X1116(the)X1247(high)X1422(mask)X1624(is)X1710(equal)X1917(to)X2011(the)X2141(next)X2311(max-)X720 3274(imum)N931(split)X1093(bucket.)X1372(To)X1486(locate)X1703(a)X1764(speci\256c)X2033(key,)X2193(we)X2311(com-)X720 3362(pute)N881(a)X940(32-bit)X1154(hash)X1324(value)X1520(using)X1715(a)X1773(bit-randomizing)X2311(algo-)X720 3450(rithm)N932(such)X1118(as)X1224(the)X1361(one)X1516(described)X1862(in)X1962([LAR88].)X2334(This)X720 3538(hash)N893(value)X1093(is)X1172(then)X1336(masked)X1607(with)X1775(the)X1898(high)X2065(mask.)X2299(If)X2378(the)X720 3626(resulting)N1026(number)X1297(is)X1376(greater)X1626(than)X1790(the)X1913(maximum)X2262(bucket)X720 3714(in)N823(the)X962(table)X1159(\(current)X1455(split)X1633(bucket)X1888(+)X1974(maximum)X2339(split)X720 3802(point\),)N962(the)X1091(hash)X1269(value)X1474(is)X1558(masked)X1834(with)X2007(the)X2136(low)X2287(mask.)X720 3890(In)N825(either)X1046(case,)X1242(the)X1377(result)X1592(of)X1696(the)X1831(mask)X2037(is)X2127(the)X2262(bucket)X720 3978(number)N989(for)X1107(the)X1229(given)X1431(key.)X1611(The)X1759(algorithm)X2093(below)X2312(illus-)X720 4066(trates)N914(this)X1049(process.)X0 f8 s720 4365(h)N796(=)X872 -0.4038(calchash\(key\);)AX720 4453(bucket)N986(=)X1062(h)X1138(&)X1214 -0.4167(high_mask;)AX720 4541(if)N834(\()X910(bucket)X1176(>)X1252 -0.4167(max_bucket)AX1670(\))X1008 4629(bucket)N1274(=)X1350(h)X1426(&)X1502 -0.4219(low_mask;)AX720 4717 -0.4018(return\(bucket\);)AN1 f10 s892 5042(In)N1013(order)X1237(to)X1353(decide)X1617(when)X1845(to)X1961(split)X2152(a)X2242(bucket,)X2 f720 5130(dynahash)N1 f1050(uses)X2 f1210(controlled)X1561(splitting)X1 f1822(.)X1884(A)X1964(hash)X2133(table)X2311(has)X2440(a)X720 5218(\256ll)N837(factor)X1054(which)X1279(is)X1361(expressed)X1707(in)X1798(terms)X2004(of)X2099(the)X2225(average)X720 5306(number)N990(of)X1082(keys)X1253(in)X1339(each)X1511(bucket.)X1789(Each)X1974(time)X2140(the)X2262(table's)X720 5394(total)N885(number)X1153(of)X1243(keys)X1413(divided)X1676(by)X1778(its)X1875(number)X2142(of)X2231(buckets)X720 5482(exceeds)N995(this)X1130(\256ll)X1238(factor,)X1466(a)X1522(bucket)X1756(is)X1829(split.)X2878 538(Since)N3079(the)X2 f3200(hsearch)X1 f3477(create)X3693(interface)X3998(\()X2 f4025(hcreate)X1 f4266(\))X4315(calls)X2706 626(for)N2842(an)X2960(estimate)X3269(of)X3378(the)X3518(\256nal)X3702(size)X3869(of)X3978(the)X4118(hash)X4306(table)X2706 714(\()N2 f2733(nelem)X1 f2925(\),)X2 f3007(dynahash)X1 f3349(uses)X3522(this)X3672(information)X4085(to)X4182(initialize)X2706 802(the)N2848(table.)X3088(The)X3257(initial)X3486(number)X3774(of)X3884(buckets)X4172(is)X4268(set)X4400(to)X2 f2706 890(nelem)N1 f2926(rounded)X3217(to)X3306(the)X3431(next)X3596(higher)X3828(pow

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -