当前位置:网站首页>散列表 ~
散列表 ~
2022-07-28 23:31:00 【柯基@】
常用 Hash 函数的构造方法
- 直接定址法
- 数字分析法
- 平方取中法
- 除留余数法
常用的 Hash 冲突处理方法
- 开放定址法
1)线性探查法
2)平方探查法 - 链地址法
eg:用关键字序列{1,9,12,11,25,35,17,29}创建一个Hash表,装填因子a为1/2,试确定表长m,采用除留余数法构造 Hash函数,采用链地址法来处理冲突,并计算查找成功与不成功时的平均查找长度 ASL,和ASL2(只将与关键字的比较计算在内)。
装填因子 = 表中记录数 / 散链表长度
则:表长 m = 16
除留余数法的Hash函数构造公式为H(key)=key Mod p ,其中p为不大于表长的最大素数
则:H(key)=key Mod 13
由此所得 Hash 表如图
查找成功的平均查找长度 ASL
ASL1=(1+1+1+1+2+1+1+2) / 8=1.25
查找不成功的平均查找长度 ASL
ASL2=(0+1+0+1+1+0+0+0+0+2+0+1+2) / 13=0.62
边栏推荐
- There is a span tag. If you want to do click events on it, how can you expand the click area
- 刷题的第三十天
- day8
- 【Web开发】Flask框架基础知识
- Teach you how to install latex (nanny level tutorial)
- Still writing a lot of if to judge? A rule executor kills all if judgments in the project
- MATLAB02:结构化编程和函数定义「建议收藏」
- Surfacecontrol and surfaceflinger communication
- How to solve the problem that the Oracle instance cannot be started
- 【commons-lang3专题】001-StringUtils 专题
猜你喜欢

ZABBIX deployment and monitoring
![Cloud function realizes website automatic check-in configuration details [web function /nodejs/cookie]](/img/e3/496247afdb3ea5b9a9cdb8afb0d41b.png)
Cloud function realizes website automatic check-in configuration details [web function /nodejs/cookie]

我不建议你使用SELECT *

NFT 项目的 7 种市场营销策略

DRF -- authentication, authority, frequency source code analysis, global exception handling, automatic generation of interface documents, RBAC introduction

Longest ascending subsequence

There is a span tag. If you want to do click events on it, how can you expand the click area

Upload Excel files with El upload and download the returned files

靠云业务独撑收入增长大梁,微软仍然被高估?

AQS原理
随机推荐
Send SMS verification code asynchronously using Ronglian cloud celery
Have you seen the management area decoupling architecture? Can help customers solve big problems
Error reporting: when the browser clicks the modify add button, there is no response and no error reporting. Solution
rk3399 9.0驱动添加Powser按键
[Yugong series] go teaching course in July 2022, an array of 020 go containers
Asynchronous mode worker thread
selenium对接代理与seleniumwire访问开发者工具NetWork
【commons-lang3专题】004- NumberUtils 专题
Andriod6.0 low power mode (turn off WiFi, Bluetooth, GPS, screen brightness, etc.)
[basic course of flight control development 8] crazy shell · open source formation uav-i2c (laser ranging)
刷题的第三十天
SAP VL02N 交货单过账函数 WS_DELIVERY_UPDATE
Rk3399 9.0 driver add powser button
Tips for API interface optimization
Surfacecontrol and surfaceflinger communication
Armeabi-v7a architecture (sv7a)
Selenium wire obtains Baidu Index
伦敦金即时行情带来什么机会?
Common sparse basis and matlab code for compressed sensing
【网络安全】通过iptables和ipset完成服务器防火墙黑名单和白名单功能