An open API service indexing awesome lists of open source software.

https://github.com/flaribbit/my-hashmap

仿照 lua table 原理实现的哈希表,略有改动
https://github.com/flaribbit/my-hashmap

Last synced: 3 months ago
JSON representation

仿照 lua table 原理实现的哈希表,略有改动

Awesome Lists containing this project

README

        

# my hashmap

仿照 lua table 原理实现的哈希表,略有改动。

哈希表在解决冲突有两个常用的方法:
- 开放定址法:把冲突数据放到空位置。
- 链地址法:把冲突数据串成单链表挂在对应位置下面。

而 lua 的实现结合了两种方法:把链表的节点放在空位置,从而节省内存,而又不增加查找和插入复杂度。

![原理图](https://img-blog.csdnimg.cn/20190630185911843.png)

具体原理参考[这篇文章](https://blog.csdn.net/y1196645376/article/details/94348873)。

## 其他
之后有时间再改用 c++ 模板实现。