- 构造
- 键值对
- 别名:key-value pairs(items)、ht_item
- 组成:char* key、char* value
- 哈希表
- 别名:hash_table、ht_hash_table
- 组成:int size、int count、ht_item** items
- 构造函数
- 特点:使用strdup()函数复制字符串
- 析构函数
- 特点:使用free()函数回收
- 键值对
- 哈希函数
- 功能:将字符串映射为0-size的一个数字
- 要求:尽量平均的分配到哈希表中
- collision
- 方法:二次散列
- 功能:将字符串映射为0-size的一个数字
- API
- insert
- 功能:找到空闲桶放置item
- 特点:针对已被删除的项HT_DELETED_ITEM可以插入
- search
- 功能:找到key等于预期值的item
- 特点:针对已被删除的项HT_DELETED_ITEM需要跳过
- delete
- 特点:待删除item可能是某个冲突链的一项、删除会导致冲突项无法找到
- 方法:使删除项的位置指向一个全局哨兵(代表已删除)
- update
- 功能:再次插入相同key时会更新上一次的value
- 特点:集成到insert函数中(在寻找空闲位置的冲突链中比较是否存在key)
- insert
- resiezing
- 功能:当load<0.1时down、当load>0.7时up
hashtable's Introduction
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.