当前位置:网站首页>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/ ︎
边栏推荐
- 427- binary tree (617. merge binary tree, 700. search in binary search tree, 98. verify binary search tree, 530. minimum absolute difference of binary search tree)
- Create a basic WDM driver and use MFC to call the driver
- Scala函数柯里化(Currying)
- TiDB 中的SQL 基本操作
- 汇编语言-王爽 第8章 数据处理的两个基本问题-笔记
- My opinion on test team construction
- 【QT小作】使用结构体数据生成读写配置文件代码
- thrift
- 【QT小点】实现看门狗功能,检测外部程序是否在运行
- multiprocessing.pool详解
猜你喜欢

Cloud-Native Database Systems at Alibaba: Opportunities and Challenges

Quick personal site building guide using WordPress

Yaml file encryption

JVM类加载机制

The risk of multithreading -- thread safety

2018年数学建模竞赛-高温作业专用服装设计

Multithreading basic Part3

Kubesphere cluster configuration NFS storage solution - favorite

LeetCode 0086. Separate linked list

观测电机转速转矩
随机推荐
Small program of C language practice (consolidate and deepen the understanding of knowledge points)
JVM常用指令
cpu-z中如何查看内存的频率和内存插槽的个数?
The SCP command is used in the expect script. The perfect solution to the problem that the SCP command in the expect script cannot obtain the value
技术人员创业一年心得
Proxy reflect usage details
【入门】正则表达式基础入门笔记
Dev++ 环境设置C语言关键字显示颜色
HTAP 快速上手指南
Convolution neural network -- Application of CNN model (ore prospecting prediction)
Information System Project Manager - Chapter VII project cost management
JVM common instructions
Matlab quickly converts two-dimensional coordinates of images into longitude and latitude coordinates
JVM调优思路
[QT notes] simple understanding of QT meta object system
Yaml file encryption
EasyExcel:读取Excel数据到List集合中
Scala advanced_ Member access modifier
[QT] use structure data to generate read / write configuration file code
Cloud-Native Database Systems at Alibaba: Opportunities and Challenges