mirror of
https://github.com/krahets/hello-algo.git
synced 2025-07-25 19:22:27 +08:00
build
This commit is contained in:
@ -22,7 +22,7 @@ comments: true
|
||||
|
||||
### 2. Q & A
|
||||
|
||||
!!! question "哈希表的时间复杂度为什么不是 $O(n)$ ?"
|
||||
!!! question "哈希表的时间复杂度在什么情况下是 $O(n)$ ?"
|
||||
|
||||
当哈希冲突比较严重时,哈希表的时间复杂度会退化至 $O(n)$ 。当哈希函数设计得比较好、容量设置比较合理、冲突比较平均时,时间复杂度是 $O(1)$ 。我们使用编程语言内置的哈希表时,通常认为时间复杂度是 $O(1)$ 。
|
||||
|
||||
|
Reference in New Issue
Block a user