Skip to content

Commit 5f642e8

Browse files
committed
Java
1 parent a0f4e4b commit 5f642e8

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

docs/data_structure/9_哈希表.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,9 @@ public class HashTable<K,V> {
283283
```
284284

285285
- 哈希表具体功能实现
286+
287+
288+
286289
```java
287290
public void add(K key,V value){
288291
TreeMap<K,V> map=hashtable[hash(key)];
@@ -321,11 +324,19 @@ public V get(K key){
321324
}
322325
```
323326

327+
328+
324329
- 哈希表链表法时间复杂度分析
325330

331+
326332
<div align="center"><img src="https://gitee.com/duhouan/ImagePro/raw/master/java-notes/dataStructure/hash//13_5.png" width="600"/></div>
327333

334+
335+
328336
## 哈希表的动态空间处理
337+
338+
339+
329340
<div align="center"><img src="https://gitee.com/duhouan/ImagePro/raw/master/java-notes/dataStructure/hash//13_6.png" width="600"/></div>
330341

331342

@@ -422,12 +433,16 @@ public class HashTable2<K,V> {
422433
}
423434
```
424435

436+
437+
425438
- 时间复杂度分析:
426439

427440
平均时间复杂度:O(1)
428441

429442
实际上每个操作的时间复杂度是:O( log(lowerTol) ) ~ O( log(upperTol) ), 而 lowerTol 和 upperTol 都是常数。
430443

444+
445+
431446
## 优化哈希表
432447

433448
```java

0 commit comments

Comments
 (0)