File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -328,6 +328,8 @@ public V get(K key){
328328## 哈希表的动态空间处理
329329<div align =" center " ><img src =" https://gitee.com/duhouan/ImagePro/raw/master/java-notes/dataStructure/hash//13_6.png " width =" 600 " /></div >
330330
331+
332+
331333``` java
332334public class HashTable2 <K,V> {
333335 private static final int upperTol= 10 ;
@@ -424,7 +426,7 @@ public class HashTable2<K,V> {
424426
425427平均时间复杂度:O(1)
426428
427- 实际上每个操作的时间复杂度是:O( log(lowerTol) ) ~ O( log(upperTol) ),而lowerTol和upperTol都是常数 。
429+ 实际上每个操作的时间复杂度是:O( log(lowerTol) ) ~ O( log(upperTol) ), 而 lowerTol 和 upperTol 都是常数 。
428430
429431## 优化哈希表
430432
@@ -535,11 +537,11 @@ Java8之前,每一个位置对应一个链表,K不要求具有可比性,所
535537Java8之后,当哈希冲突得到一定程度时,每一个位置从链表转化成红黑树,这时就要求K具有可比性。
536538
537539## 开放地址法解决哈希冲突
538- 1. 线性探测法
540+ ### 1. 线性探测法
539541
540542每次遇到哈希冲突,就+1
541543
542- 2. 平方探测法
544+ ### 2. 平方探测法
543545
544546遇到哈希冲突, 就+1
545547
@@ -549,7 +551,7 @@ Java8之后,当哈希冲突得到一定程度时,每一个位置从链表转
549551
550552...
551553
552- 3. 二次哈希
554+ ### 3. 二次哈希
553555
554556每次遇到哈希冲突,就 +hash2(key)
555557
You can’t perform that action at this time.
0 commit comments