作者zptdaniel ()
看板TransCSI
标题Re: [问题] open hashing
时间Wed Apr 29 20:06:30 2009
※ 引述《p158276 (孤寂的心)》之铭言:
: In open hashing, with the quotient-offset collision handler, insert the following keys into a table
: of size 11:33, 22, 26, 48, 19. Show the resulting table.
: 这题要怎麽解?
: 什麽是open hashing???
: 题目摘自96联大计概考题
: 第一次发文若有任何错误请多包涵@@"
open hashing..google一下应该很多.
(我不会解释XD)
key key%11 key/11
33 0 3
22 0 2
26 4 2
48 4 4
19 8 1
( key%11 : 代表该key应该对应到的slot)
( key/11 : 代表发生碰撞时的修正量,新的slot = key%11 + key/11)
table 0 1 2 3 4 5 6 7 8 9 10
key 33 22* 26 48* 19*
P.S. 上面有加上*的代表说有发生碰撞.
以22为例,22%11=0 所以22应该要放入slot 0 但是发生碰撞
(33先把22的slot抢走了)
所以22的新位置是 22%11 + 22/11 = 2
quotient-offset的意思就是说当发生碰撞时,利用quotient进行修正的动作.
--
当财团老板在剥削欺压劳工阶层时,我保持沉默,因为我不是广大劳动阶层。
当两党恶斗阶级世袭社会不公不义,我保持沉默,因为我非蓝非绿中间选民。
当学测考40几级分的权贵当医生时,没有人作声,因为全都死在手术台上了。
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 123.194.100.216