当前位置:网站首页>extendible hashing
extendible hashing
2022-06-27 06:29:00 【honky-tonk_ man】
Preface
First, what is an extensible hash (Extendible Hashing)?
We usually use hash It's all static hash, For example, a number wants to be deposited into hash In the table , Go first hash function , Then save it into the corresponding hash In the table , Pay attention to this hash The table is a static , Its size is fixed at the beginning of creation , As we store more and more data ,hash The watch is getting slower and slower , The conflict rate is also increasing , We'd better maintain hash The number of elements in the table accounts for hash 70% of the capacity of the meter , In this way, the conflict rate can be kept low , At this point, we use dynamic hash, That is, our extensibility hash
Scalable hash structure
Scalable hash Yes 2 Kinds of structure , Namely
- directory: Is an extensible array , Each array element stores a bucket The pointer to ,directory Each element has a unique id, This id interesting , Is a binary number
- bucket: As long as this is hash All the watches , Used to store hash Table data , In other words, more than one bucket form hash surface
- global depth: This thing and directory It matters , because directory Each array element of the has a unique id, This id It's binary bit Composition e.g 1,11,011, and global depth On behalf of you directory id There is one bit, Like our global depth by 3, So it corresponds to directory id At most 111, explain directory id At most 7, That is to say, at most 8 Array elements
- local depth: and global almost , however local depth It's corresponding to bucket,local depth Always less than or equal to global depth
About bucket, When one bucket The number of elements in exceeds the specified number , here bucket There will be divisions (bucket splitting)
About Directory, When bucket Split up ,directory It will happen expansion
Scalable hash The process of
Our traditional static hash The process is hash Function directly stores the value in the corresponding bucket, But in extensibility hash in , First pass through hash The function is stored in Directory in , Again by directory Pointing to corresponding bucket, The specific process is as follows
To be analyzed hash Of key The type of , May be int, May be string, May be float wait , Suppose our key Namely int Type digital 49
take key Convert to binary form ,49 Convert to binary to 110001
check global depth , hypothesis global depth by 3
Select corresponding directory, How to choose ? our 49 Binary for 110001 altogether 6 position , and global depth by 3, It only needs 3 position , At this point we intercept 110001 The last three 001 As directory id
Start positioning to the corresponding bucket in
Start inserting elements , Again check bucket whether overflow
7. If overflow, And Corresponding bucket Of local depth be equal to global depth Add one to all , And then again hash overflow Of bucketBe careful global depth Adding one will add a lot of elements , At this point, we need to point these extra array elements to local depth Less than global depth Of bucket On
- If overflow And the corresponding bucket Of loacl depth Greater than global depth, Only the corresponding bucket Of local depth Add one and re hash This overflow Of bucket that will do
Reference from 1
https://www.geeksforgeeks.org/extendible-hashing-dynamic-approach-to-dbms/ ︎
边栏推荐
- Quick personal site building guide using WordPress
- IDEA一键生成Log日志
- 程序猿学习抖音短视频制作
- JVM class loading mechanism
- 快速实现单片机和手机蓝牙通信
- C语言练手小项目(巩固加深知识点理解)
- Thinking technology: how to solve the dilemma in work and life?
- Proxy-Reflect使用详解
- 高斯分布Gaussian distribution、線性回歸、邏輯回歸logistics regression
- How to check the frequency of memory and the number of memory slots in CPU-Z?
猜你喜欢

第 299 场周赛 第四题 6103. 从树中删除边的最小分数

thrift

块级元素&行内元素

Convolution neural network -- Application of CNN model (ore prospecting prediction)

426-二叉树(513.找树左下角的值、112. 路径总和、106.从中序与后序遍历序列构造二叉树、654. 最大二叉树)

程序猿学习抖音短视频制作

快速实现蓝牙iBeacn功能详解

多线程带来的的风险——线程安全

426 binary tree (513. find the value in the lower left corner of the tree, 112. sum of paths, 106. construct a binary tree from the middle order and post order traversal sequence, 654. maximum binary

cpu-z中如何查看内存的频率和内存插槽的个数?
随机推荐
Sqlsever 字段相乘后保留2位小数
Crawler learning 5--- anti crawling identification picture verification code (ddddocr and pyteseract measured effect)
TiDB 数据库快速上手指南
免费的 SSH 和 Telnet 客户端PuTTY
Scala之偏函数Partial Function
使用CSDN 开发云搭建导航网站
Once spark reported an error: failed to allocate a page (67108864 bytes), try again
ORA-00909: 参数个数无效,concat引起
[QT] use structure data to generate read / write configuration file code
Jump details of item -h5 list, and realize the function of not refreshing when backing up, and refreshing when modifying data (record scroll bar)
汇编语言-王爽 第13章 int指令-笔记
310. minimum height tree
创建一个基础WDM驱动,并使用MFC调用驱动
thrift
Altium Designer 19 器件丝印标号位置批量统一摆放
Keep 2 decimal places after multiplying SQLSEVER fields
JS to implement bidirectional data binding
HTAP 快速上手指南
Dev++ environment setting C language keyword display color
【入门】正则表达式基础入门笔记