问题6:上面的讨论与实际的Hashing有什么差别?In feasible sizeVery large,butonlyasmallpartisusedinanE[0]applicationatacertainIndexdistributiontimeE[1].Collisionhandling+.......HashFunctionKeySpaceE[K]H(x)=k........Value of aspecifickeyAcalculatedarrayindexforthe keyE[m-1]选择好的Hashing函数很重要!
Key Space Hash Function E[0] E[1] E[m-1] Value of a specific key A calculated array index for the key Very large, but only a small part is used in an application at a certain time In feasible size • Index distribution • Collision handling E[k] x H(x)=k 选择好的Hashing函数很重要!
两种设计Hashing函数的简单方法Inthedivisionmethodforcreatinghashfunctions,wemapakeykintooneofmslotsbytakingtheremainderofkdividedbym.Thatis,thehashfunctionish(k)=kmodmThemultiplication methodforcreatinghashfunctions operates in two steps.Firstwe multiply thekeykby a constant A in the range O<A<1 and extract thefractionalpartofkA.Then,wemultiplythisvaluebymandtaketheflooroftheresultIn short.thehashfunctionish(k)=|m(kAmod1)l
两种设计Hashing函数的简单方法