(8.6.1)--ch8-6哈希处理冲突.pdf
《(8.6.1)--ch8-6哈希处理冲突.pdf》由会员分享,可在线阅读,更多相关《(8.6.1)--ch8-6哈希处理冲突.pdf(8页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、 Data Structures and AlgorithmsConflict-Handing Methods of Hash Table Data Structures and Algorithms Data Structures and Algorithms SearchSearchFind an address sequence for the conflicting address H(key):H0,H1,H2,Hs 1 sm-1 Among them:H0=H(key)Hi=(H(key)+di)MOD m i=1,2,s8.4 Hash table and its search3
2、)conflict-handing methods1.Open addressing“Handle conflicts”is to find a proper next hash address instead of the conflicted one.Data Structures and Algorithms Data Structures and Algorithms SearchSearchThere are three options for the increment di:1)Linear probing rehash di=c i the simplest case c=12
3、)Quadratic probing rehash di=12,-12,22,-22,3)pseudo-random probing rehash di=pseudo-random number sequence8.4 Hash table and its search3)conflict-handing methods1.Open addressingData Structures and Algorithms Data Structures and Algorithms SearchSearchFor example:keyword collection19,01,23,14,55,68,
4、11,82,36Set hash function H(key)=key MOD 11(table length=11)0123456789101901 23 145568 11 82 36key19 01 23 14 55 68 11 82 36K%118113020531)Linear probing rehashFeatures:When a conflict occurs,check the next unit in the table in order until an empty unit is found or the entire table is searched.8.4 H
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 8.6 ch8 处理 冲突
限制150内