mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-12-25 22:46:20 +08:00
Fix zh-CN README.
This commit is contained in:
parent
23947bd9ad
commit
ab51eb5d51
@ -263,22 +263,22 @@ npm test -- 'playground'
|
||||
| **队列** | n | n | 1 | 1 | |
|
||||
| **链表** | n | n | 1 | 1 | |
|
||||
| **哈希表** | - | n | n | n | 在完全哈希函数情况下,复杂度是 O(1) |
|
||||
| **二分查找树** | n | n | n | n | 在平衡树情况下,复杂度是 O(logg(n)) |
|
||||
| **B 树** | log(n) | log(n) | log(n) | log(n) | |
|
||||
| **二分查找树** | n | n | n | n | 在平衡树情况下,复杂度是 O(log(n)) |
|
||||
| **B 树** | log(n) | log(n) | log(n) | log(n) | |
|
||||
| **红黑树** | log(n) | log(n) | log(n) | log(n) | |
|
||||
| **AVL 树** | log(n) | log(n) | log(n) | log(n) | |
|
||||
| **AVL 树** | log(n) | log(n) | log(n) | log(n) | |
|
||||
| **布隆过滤器** | - | 1 | 1 | - | 存在一定概率的判断错误(误判成存在) |
|
||||
|
||||
### 数组排序算法的复杂性
|
||||
|
||||
| 名称 | 最优 | 平均 | 最坏 | 内存 | 稳定 | 备注 |
|
||||
| 名称 | 最优 | 平均 | 最坏 | 内存 | 稳定 | 备注 |
|
||||
| --------------------- | :-------: | :-------: | :-----------: | :-------: | :-------: | --------------------- |
|
||||
| **冒泡排序** | n | n^2 | n^2 | 1 | Yes | |
|
||||
| **插入排序** | n | n^2 | n^2 | 1 | Yes | |
|
||||
| **选择排序** | n^2 | n^2 | n^2 | 1 | No | |
|
||||
| **堆排序** | n log(n) | n log(n) | n log(n) | 1 | No | |
|
||||
| **归并排序** | n log(n) | n log(n) | n log(n) | n | Yes | |
|
||||
| **冒泡排序** | n | n^2 | n^2 | 1 | Yes | |
|
||||
| **插入排序** | n | n^2 | n^2 | 1 | Yes | |
|
||||
| **选择排序** | n^2 | n^2 | n^2 | 1 | No | |
|
||||
| **堆排序** | n log(n) | n log(n) | n log(n) | 1 | No | |
|
||||
| **归并排序** | n log(n) | n log(n) | n log(n) | n | Yes | |
|
||||
| **快速排序** | n log(n) | n log(n) | n^2 | log(n) | No | 在 in-place 版本下,内存复杂度通常是 O(log(n)) |
|
||||
| **希尔排序** | n log(n) | 取决于差距序列 | n (log(n))^2 | 1 | No | |
|
||||
| **计数排序** | n + r | n + r | n + r | n + r | Yes | r - 数组里最大的数 |
|
||||
| **基数排序** | n * k | n * k | n * k | n + k | Yes | k - 最长 key 的升序 |
|
||||
| **希尔排序** | n log(n) | 取决于差距序列 | n (log(n))^2 | 1 | No | |
|
||||
| **计数排序** | n + r | n + r | n + r | n + r | Yes | r - 数组里最大的数 |
|
||||
| **基数排序** | n * k | n * k | n * k | n + k | Yes | k - 最长 key 的升序 |
|
||||
|
Loading…
Reference in New Issue
Block a user