摘要:
处理散列表中冲突的方法有:分离链接、线性探查和双散列法。 分离链接法:为散列表的每一个位置创建一个链表并将元素存储到里面。 相对于之前的散列表只需重写put、get和remove方法。 put(key, value) { if (key == null || value == null) { //键 阅读全文
摘要:
散列算法的作用是尽可能快地在数据结构中找到一个值。 散列函数的作用是给定一个键值,然后返回值在表中的地址。 class ValuePair { //用于存放一对键值对 constructor(key, value) { this.key = key; this.value = value; } to 阅读全文