湘潭大学数据结构课件pptCh05Hashing.pptVIP

  • 4
  • 0
  • 约1.36万字
  • 约 39页
  • 2019-09-14 发布于湖北
  • 举报
§3 分离链接法 ? 在散列表中查找key Position Find ( ElementType Key, HashTable H ) { Position P; List L; L = H-TheLists[ Hash( Key, H-TableSize ) ]; P = L-Next; while( P != NULL P-Element != Key ) /* Probably need strcmp */ P = P-Next; return P; } 你的散列函数 等同于第三章中给出的执行Find 的程序 -- List ADT §3 分离链接法 ? 向散列表中插入 key void Insert ( ElementType Key, HashTable H ) { Position Pos, NewCell; List L; Pos = Find( Key, H ); if ( Pos == NULL ) { /* Key is not found, then insert */ NewCell = malloc( sizeof( struct ListNode ) ); if ( NewCell == NULL )

文档评论(0)

1亿VIP精品文档

相关文档