Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6e9c16c

Browse files
committed
文档更新
1 parent 1800334 commit 6e9c16c

File tree

17 files changed

+148
-124
lines changed

17 files changed

+148
-124
lines changed

‎README.zh-CN.md‎

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# JavaScript 算法与数据结构
22

3-
## TypeScript 版本
4-
5-
参考 https://github.com/loiane/javascript-datastructures-algorithms
6-
73
[![CI](https://github.com/trekhleb/javascript-algorithms/workflows/CI/badge.svg)](https://github.com/trekhleb/javascript-algorithms/actions?query=workflow%3ACI+branch%3Amaster)
84
[![codecov](https://codecov.io/gh/trekhleb/javascript-algorithms/branch/master/graph/badge.svg)](https://codecov.io/gh/trekhleb/javascript-algorithms)
95

@@ -288,7 +284,6 @@ npm test -- 'playground'
288284

289285
### 数组排序算法的复杂性
290286

291-
<<<<<<< HEAD
292287
| 名称 | 最优 | 平均 | 最坏 | 内存 | 稳定 | 备注 |
293288
| ------------ | :------: | :------------: | :----------: | :----: | :--: | ---------------------------------------------- |
294289
| **冒泡排序** | n | n^2 | n^2 | 1 | Yes | |
@@ -302,29 +297,16 @@ npm test -- 'playground'
302297
| **基数排序** | n \* k | n \* k | n \* k | n + k | Yes | k - 最长 key 的升序 |
303298

304299
> 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 的升序 |
317300
318301
## 扩展学习
319302

320-
*TypeScript 版本
321-
*算法可视化
303+
-[TypeScript 版本](https://github.com/loiane/javascript-datastructures-algorithms)
304+
-[算法可视化](https://visualgo.net/zh)
322305

323306
参考资料
324307

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

‎src/algorithms/math/bits/README.zh-CN.md‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ _Read this in other languages:_
44
[français](README.fr-FR.md),
55
[english](README.md)
66

7+
### Bit 操控
8+
9+
- set
10+
- get
11+
- update
12+
- clear
13+
-
14+
-
15+
- 变负
16+
717
#### Get Bit
818

919
该方法向右移动目标位到最右边,即位数组的第0个位置上。然后在该数上与形如 `0001`的二进制形式的数进行`AND`操作。这会清理掉除了目标位的所有其它位的数据。如果目标位是1,那么结果就是`1`,反之,结果是`0`;
@@ -226,7 +236,7 @@ B = 6: 110
226236
└──────┴────┴────┴─────────┴──────────┴─────────┴───────────┴───────────┘
227237
```
228238

229-
> 查看[fullAdder.js](fullAdder.js)了解更多细节。
239+
> 查看[fullAdder.js](fullAdder.js)了解更多细节。
230240
> 查看[Full Adder on YouTube](https://www.youtube.com/watch?v=wvJc9CZcvBc&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8).
231241
232242
## References

‎src/algorithms/math/bits/bitLength.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/**
22
* Return the number of bits used in the binary representation of the number.
3+
* or number.toString(2).length
34
*
45
* @param {number} number
56
* @return {number}

‎src/algorithms/math/complex-number/README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Complex Number
22

3+
复数 - 复数及其基本运算
4+
35
_Read this in other languages:_
46
[français](README.fr-FR.md).
57

‎src/algorithms/math/euclidean-algorithm/README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Euclidean algorithm
22

3+
欧几里得算法 - 计算最大公约数 (GCD)
4+
35
_Read this in other languages:_
46
[français](README.fr-FR.md).
57

‎src/algorithms/math/factorial/README.zh-CN.md‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
5! = 5 * 4 * 3 * 2 * 1 = 120
77
```
88

9-
| n | n! |
9+
| n | n! |
1010
| ----- | --------------------------: |
1111
| 0 | 1 |
1212
| 1 | 1 |
@@ -25,3 +25,8 @@
2525
| 14 | 87 178 291 200 |
2626
| 15 | 1 307 674 368 000 |
2727

28+
实现方式
29+
30+
- 迭代方式 iter
31+
- 递归方式 recurse
32+
- 尾递归优化 tail

‎src/algorithms/math/fast-powering/README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Fast Powering Algorithm
22

3+
快速算次方
4+
35
_Read this in other languages:_
46
[français](README.fr-FR.md).
57

‎src/algorithms/math/fibonacci/README.zh-CN.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# 斐波那契数
22

3+
斐波那契数 - `经典``闭式` 版本
4+
35
_Read this in other languages:_
46
[français](README.fr-FR.md),
57
[english](README.md),

‎src/algorithms/math/fourier-transform/README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
_Read this in other languages:_
44
[français](README.fr-FR.md).
55

6+
离散傅里叶变换 - 把时间信号解析成构成它的频率
7+
68
## Definitions
79

810
The **Fourier Transform** (**FT**) decomposes a function of time (a signal) into

‎src/algorithms/math/integer-partition/README.md‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# Integer Partition
22

3-
In number theory and combinatorics, a partition of a positive
4-
integer `n`, also called an **integer partition**, is a way of
5-
writing `n` as a sum of positive integers.
3+
整数拆分
64

7-
Two sums that differ only in the order of their summands are
8-
considered the same partition. For example, `4` can be partitioned
5+
In number theory and combinatorics, a partition of a positive
6+
integer `n`, also called an **integer partition**, is a way of
7+
writing `n` as a sum of positive integers.
8+
9+
Two sums that differ only in the order of their summands are
10+
considered the same partition. For example, `4` can be partitioned
911
in five distinct ways:
1012

1113
```
@@ -17,13 +19,13 @@ in five distinct ways:
1719
```
1820

1921
The order-dependent composition `1 + 3` is the same partition
20-
as `3 + 1`, while the two distinct
21-
compositions `1 + 2 + 1` and `1 + 1 + 2` represent the same
22+
as `3 + 1`, while the two distinct
23+
compositions `1 + 2 + 1` and `1 + 1 + 2` represent the same
2224
partition `2 + 1 + 1`.
2325

2426
Young diagrams associated to the partitions of the positive
25-
integers `1` through `8`. They are arranged so that images
26-
under the reflection about the main diagonal of the square
27+
integers `1` through `8`. They are arranged so that images
28+
under the reflection about the main diagonal of the square
2729
are conjugate partitions.
2830

2931
![Integer Partition](https://upload.wikimedia.org/wikipedia/commons/d/d8/Ferrer_partitioning_diagrams.svg)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /