1
1
# JavaScript 算法与数据结构
2
2
3
- ## TypeScript 版本
4
-
5
- 参考 https://github.com/loiane/javascript-datastructures-algorithms
6
-
7
3
[ ![ CI] ( https://github.com/trekhleb/javascript-algorithms/workflows/CI/badge.svg )] ( https://github.com/trekhleb/javascript-algorithms/actions?query=workflow%3ACI+branch%3Amaster )
8
4
[ ![ codecov] ( https://codecov.io/gh/trekhleb/javascript-algorithms/branch/master/graph/badge.svg )] ( https://codecov.io/gh/trekhleb/javascript-algorithms )
9
5
@@ -288,7 +284,6 @@ npm test -- 'playground'
288
284
289
285
### 数组排序算法的复杂性
290
286
291
- <<<<<<< HEAD
292
287
| 名称 | 最优 | 平均 | 最坏 | 内存 | 稳定 | 备注 |
293
288
| ------------ | :------: | :------------: | :----------: | :----: | :--: | ---------------------------------------------- |
294
289
| ** 冒泡排序** | n | n^2 | n^2 | 1 | Yes | |
@@ -302,29 +297,16 @@ npm test -- 'playground'
302
297
| ** 基数排序** | n \* k | n \* k | n \* k | n + k | Yes | k - 最长 key 的升序 |
303
298
304
299
> i️ A few more [ projects] ( https://trekhleb.dev/projects/ ) and [ articles] ( https://trekhleb.dev/blog/ ) about JavaScript and algorithms on [ trekhleb.dev] ( https://trekhleb.dev )
305
- =======
306
- | 名称 | 最优 | 平均 | 最坏 | 内存 | 稳定 | 备注 |
307
- | --------------------- | :-------: | :-------: | :-----------: | :-------: | :-------: | --------------------- |
308
- | ** 冒泡排序** | n | n^2 | n^2 | 1 | Yes | |
309
- | ** 插入排序** | n | n^2 | n^2 | 1 | Yes | |
310
- | ** 选择排序** | n^2 | n^2 | n^2 | 1 | No | |
311
- | ** 堆排序** | n log(n) | n log(n) | n log(n) | 1 | No | |
312
- | ** 归并排序** | n log(n) | n log(n) | n log(n) | n | Yes | |
313
- | ** 快速排序** | n log(n) | n log(n) | n^2 | log(n) | No | 在 in-place 版本下,内存复杂度通常是 O(log(n)) |
314
- | ** 希尔排序** | n log(n) | 取决于差距序列 | n (log(n))^2 | 1 | No | |
315
- | ** 计数排序** | n + r | n + r | n + r | n + r | Yes | r - 数组里最大的数 |
316
- | ** 基数排序** | n * k | n * k | n * k | n + k | Yes | k - 最长 key 的升序 |
317
300
318
301
## 扩展学习
319
302
320
- * TypeScript 版本
321
- * 算法可视化
303
+ - [ TypeScript 版本] ( https://github.com/loiane/javascript-datastructures-algorithms )
304
+ - [ 算法可视化] ( https://visualgo.net/zh )
322
305
323
306
参考资料
324
307
325
- * https://github.com/loiane/javascript-datastructures-algorithms
326
- * https://visualgo.net/zh
327
- * https://coolshell.cn/articles/4671.html
328
- * https://www.cs.usfca.edu/~galles/visualization/Algorithms.html
329
- * https://www.cs.usfca.edu/~galles/visualization/source.html
330
- >>>>>>> 5b541e4 (更新文档)
308
+ - https://github.com/loiane/javascript-datastructures-algorithms
309
+ - https://visualgo.net/zh
310
+ - https://coolshell.cn/articles/4671.html
311
+ - https://www.cs.usfca.edu/~galles/visualization/Algorithms.html
312
+ - https://www.cs.usfca.edu/~galles/visualization/source.html
0 commit comments