99
1010_ Read this in other languages:_
1111[ _ English_ ] ( https://github.com/trekhleb/javascript-algorithms/ ) ,
12- [ 繁體中文] ( https://github.com/trekhleb/javascript-algorithms/blob/master/ README.zh-TW.md)
12+ [ 繁體中文] ( README.zh-TW.md )
1313
1414## 数据结构
1515
1616数据结构是在计算机中组织和存储数据的一种特殊方式,它可以高效地访问和修改数据。更确切地说,数据结构是数据值的集合,它们之间的关系、函数或操作可以应用于数据。
1717
18- * [ 链表] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/data-structures/linked-list)
19- * [ 队列] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/data-structures/queue)
20- * [ 栈] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/data-structures/stack)
21- * [ 哈希表] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/data-structures/hash-table)
22- * [ 堆] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/data-structures/heap)
23- * [ 优先队列] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/data-structures/priority-queue)
24- * [ 字典树] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/data-structures/trie)
25- * [ 树] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/data-structures/tree)
26- * [ 二分查找] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/data-structures/tree/binary-search-tree)
27- * [ AVL 树] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/data-structures/tree/avl-tree)
28- * [ 红黑树] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/data-structures/tree/red-black-tree)
29- * [ 图] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/data-structures/graph) (有向图与无向图)
30- * [ 并查集] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/data-structures/disjoint-set)
18+ * [ 链表] ( src/data-structures/linked-list )
19+ * [ 队列] ( src/data-structures/queue )
20+ * [ 栈] ( src/data-structures/stack )
21+ * [ 哈希表] ( src/data-structures/hash-table )
22+ * [ 堆] ( src/data-structures/heap )
23+ * [ 优先队列] ( src/data-structures/priority-queue )
24+ * [ 字典树] ( src/data-structures/trie )
25+ * [ 树] ( src/data-structures/tree )
26+ * [ 二分查找] ( src/data-structures/tree/binary-search-tree )
27+ * [ AVL 树] ( src/data-structures/tree/avl-tree )
28+ * [ 红黑树] ( src/data-structures/tree/red-black-tree )
29+ * [ 图] ( src/data-structures/graph ) (有向图与无向图)
30+ * [ 并查集] ( src/data-structures/disjoint-set )
3131
3232## 算法
3333
@@ -36,101 +36,101 @@ _Read this in other languages:_
3636### 算法主题
3737
3838* ** 数学**
39- * [ 阶乘] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/math/factorial)
40- * [ 斐波那契数] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/math/fibonacci)
41- * [ 素数检测] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/math/primality-test) (排除法)
42- * [ 欧几里得算法] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/math/euclidean-algorithm) - 计算最大公约数(GCD)
43- * [ 最小公倍数] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/math/least-common-multiple) (LCM)
44- * [ 整数拆分] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/math/integer-partition)
39+ * [ 阶乘] ( src/algorithms/math/factorial )
40+ * [ 斐波那契数] ( src/algorithms/math/fibonacci )
41+ * [ 素数检测] ( src/algorithms/math/primality-test ) (排除法)
42+ * [ 欧几里得算法] ( src/algorithms/math/euclidean-algorithm ) - 计算最大公约数(GCD)
43+ * [ 最小公倍数] ( src/algorithms/math/least-common-multiple ) (LCM)
44+ * [ 整数拆分] ( src/algorithms/math/integer-partition )
4545* ** 集合**
46- * [ 笛卡尔积] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/sets/cartesian-product) - 多集合结果
47- * [ 幂集] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/sets/power-set) - 该集合的所有子集
48- * [ 排列] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/sets/permutations) (有/无重复)
49- * [ 组合] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/sets/combinations) (有/无重复)
50- * [ 洗牌算法] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/sets/fisher-yates) - 随机置换有限序列
51- * [ 最长公共子序列] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/sets/longest-common-subsequence) (LCS)
52- * [ 最长递增子序列] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/sets/longest-increasing-subsequence)
53- * [ Shortest Common Supersequence] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/sets/shortest-common-supersequence) (SCS)
54- * [ 背包问题] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/sets/knapsack-problem) - "0/1" and "Unbound" ones
55- * [ 最大子数列问题] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/sets/maximum-subarray) - BF算法 与 动态编程
46+ * [ 笛卡尔积] ( src/algorithms/sets/cartesian-product ) - 多集合结果
47+ * [ 幂集] ( src/algorithms/sets/power-set ) - 该集合的所有子集
48+ * [ 排列] ( src/algorithms/sets/permutations ) (有/无重复)
49+ * [ 组合] ( src/algorithms/sets/combinations ) (有/无重复)
50+ * [ 洗牌算法] ( src/algorithms/sets/fisher-yates ) - 随机置换有限序列
51+ * [ 最长公共子序列] ( src/algorithms/sets/longest-common-subsequence ) (LCS)
52+ * [ 最长递增子序列] ( src/algorithms/sets/longest-increasing-subsequence )
53+ * [ Shortest Common Supersequence] ( src/algorithms/sets/shortest-common-supersequence ) (SCS)
54+ * [ 背包问题] ( src/algorithms/sets/knapsack-problem ) - "0/1" and "Unbound" ones
55+ * [ 最大子数列问题] ( src/algorithms/sets/maximum-subarray ) - BF算法 与 动态编程
5656* ** 字符串**
57- * [ 莱温斯坦距离] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/string/levenshtein-distance) - 两个序列之间的最小编辑距离
58- * [ 汉明距离] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/string/hamming-distance) - 符号不同的位置数
59- * [ 克努斯-莫里斯-普拉特算法] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/string/knuth-morris-pratt) - 子串搜索
60- * [ 字符串快速查找] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/string/rabin-karp) - 子串搜索
61- * [ 最长公共子串] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/string/longest-common-substring)
57+ * [ 莱温斯坦距离] ( src/algorithms/string/levenshtein-distance ) - 两个序列之间的最小编辑距离
58+ * [ 汉明距离] ( src/algorithms/string/hamming-distance ) - 符号不同的位置数
59+ * [ 克努斯-莫里斯-普拉特算法] ( src/algorithms/string/knuth-morris-pratt ) - 子串搜索
60+ * [ 字符串快速查找] ( src/algorithms/string/rabin-karp ) - 子串搜索
61+ * [ 最长公共子串] ( src/algorithms/string/longest-common-substring )
6262* ** 搜索**
63- * [ 二分查找] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/search/binary-search)
63+ * [ 二分查找] ( src/algorithms/search/binary-search )
6464* ** 排序**
65- * [ 冒泡排序] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/sorting/bubble-sort)
66- * [ 选择排序] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/sorting/selection-sort)
67- * [ 插入排序] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/sorting/insertion-sort)
68- * [ 堆排序] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/sorting/heap-sort)
69- * [ 归并排序] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/sorting/merge-sort)
70- * [ 快速排序] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/sorting/quick-sort)
71- * [ 希尔排序] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/sorting/shell-sort)
65+ * [ 冒泡排序] ( src/algorithms/sorting/bubble-sort )
66+ * [ 选择排序] ( src/algorithms/sorting/selection-sort )
67+ * [ 插入排序] ( src/algorithms/sorting/insertion-sort )
68+ * [ 堆排序] ( src/algorithms/sorting/heap-sort )
69+ * [ 归并排序] ( src/algorithms/sorting/merge-sort )
70+ * [ 快速排序] ( src/algorithms/sorting/quick-sort )
71+ * [ 希尔排序] ( src/algorithms/sorting/shell-sort )
7272* ** 树**
73- * [ 深度优先搜索] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/tree/depth-first-search) (DFS)
74- * [ 广度优先搜索] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/tree/breadth-first-search) (BFS)
73+ * [ 深度优先搜索] ( src/algorithms/tree/depth-first-search ) (DFS)
74+ * [ 广度优先搜索] ( src/algorithms/tree/breadth-first-search ) (BFS)
7575* ** 图**
76- * [ 深度优先搜索] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/graph/depth-first-search) (DFS)
77- * [ 广度优先搜索] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/graph/breadth-first-search) (BFS)
78- * [ 戴克斯特拉算法m] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/graph/dijkstra) - 找到所有图顶点的最短路径
79- * [ 贝尔曼-福特算法] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/graph/bellman-ford) - 找到所有图顶点的最短路径
80- * [ 判圈算法] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/graph/detect-cycle) - 对于有向图和无向图(基于DFS和不相交集的版本)
81- * [ 普林演算法] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/graph/prim) - 寻找加权无向图的最小生成树(MST)
82- * [ 克鲁斯克尔演算法] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/graph/kruskal) - 寻找加权无向图的最小生成树(MST)
83- * [ 拓撲排序] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/graph/topological-sorting) - DFS 方法
84- * [ 关节点] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/graph/articulation-points) - Tarjan算法(基于DFS)
85- * [ 桥] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/graph/bridges) - 基于DFS的算法
86- * [ 欧拉路径与一笔画问题] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/graph/eulerian-path) - Fleury的算法 - 一次访问每个边缘
87- * [ 哈密顿图] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/graph/hamiltonian-cycle) - 恰好访问每个顶点一次
88- * [ 强连通分量] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/graph/strongly-connected-components) - Kosaraju算法
89- * [ 旅行推销员问题] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/graph/travelling-salesman) - 尽可能以最短的路线访问每个城市并返回原始城市
76+ * [ 深度优先搜索] ( src/algorithms/graph/depth-first-search ) (DFS)
77+ * [ 广度优先搜索] ( src/algorithms/graph/breadth-first-search ) (BFS)
78+ * [ 戴克斯特拉算法m] ( src/algorithms/graph/dijkstra ) - 找到所有图顶点的最短路径
79+ * [ 贝尔曼-福特算法] ( src/algorithms/graph/bellman-ford ) - 找到所有图顶点的最短路径
80+ * [ 判圈算法] ( src/algorithms/graph/detect-cycle ) - 对于有向图和无向图(基于DFS和不相交集的版本)
81+ * [ 普林演算法] ( src/algorithms/graph/prim ) - 寻找加权无向图的最小生成树(MST)
82+ * [ 克鲁斯克尔演算法] ( src/algorithms/graph/kruskal ) - 寻找加权无向图的最小生成树(MST)
83+ * [ 拓撲排序] ( src/algorithms/graph/topological-sorting ) - DFS 方法
84+ * [ 关节点] ( src/algorithms/graph/articulation-points ) - Tarjan算法(基于DFS)
85+ * [ 桥] ( src/algorithms/graph/bridges ) - 基于DFS的算法
86+ * [ 欧拉路径与一笔画问题] ( src/algorithms/graph/eulerian-path ) - Fleury的算法 - 一次访问每个边缘
87+ * [ 哈密顿图] ( src/algorithms/graph/hamiltonian-cycle ) - 恰好访问每个顶点一次
88+ * [ 强连通分量] ( src/algorithms/graph/strongly-connected-components ) - Kosaraju算法
89+ * [ 旅行推销员问题] ( src/algorithms/graph/travelling-salesman ) - 尽可能以最短的路线访问每个城市并返回原始城市
9090* ** 未分类**
91- * [ 汉诺塔] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/uncategorized/hanoi-tower)
92- * [ 八皇后问题] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/uncategorized/n-queens)
93- * [ 骑士巡逻] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/uncategorized/knight-tour)
91+ * [ 汉诺塔] ( src/algorithms/uncategorized/hanoi-tower )
92+ * [ 八皇后问题] ( src/algorithms/uncategorized/n-queens )
93+ * [ 骑士巡逻] ( src/algorithms/uncategorized/knight-tour )
9494
9595### 算法范式
9696
9797算法范式是基于类的设计的通用方法或方法的算法。 这是一个比算法概念更高的抽象,就像一个
9898算法是比计算机程序更高的抽象。
9999
100100* ** BF算法** - 查找所有可能性并选择最佳解决方案
101- * [ 最大子数列] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/sets/maximum-subarray)
102- * [ 旅行推销员问题] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/graph/travelling-salesman) - 尽可能以最短的路线访问每个城市并返回原始城市
101+ * [ 最大子数列] ( src/algorithms/sets/maximum-subarray )
102+ * [ 旅行推销员问题] ( src/algorithms/graph/travelling-salesman ) - 尽可能以最短的路线访问每个城市并返回原始城市
103103
104104* ** 贪心法** - 在当前选择最佳选项,不考虑以后情况
105- * [ 背包问题] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/sets/knapsack-problem)
106- * [ 戴克斯特拉算法] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/graph/dijkstra) - 找到所有图顶点的最短路径
107- * [ 普里姆算法] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/graph/prim) - 寻找加权无向图的最小生成树(MST)
108- * [ 克鲁斯卡尔算法] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/graph/kruskal) - 寻找加权无向图的最小生成树(MST)
105+ * [ 背包问题] ( src/algorithms/sets/knapsack-problem )
106+ * [ 戴克斯特拉算法] ( src/algorithms/graph/dijkstra ) - 找到所有图顶点的最短路径
107+ * [ 普里姆算法] ( src/algorithms/graph/prim ) - 寻找加权无向图的最小生成树(MST)
108+ * [ 克鲁斯卡尔算法] ( src/algorithms/graph/kruskal ) - 寻找加权无向图的最小生成树(MST)
109109* ** 分治法** - 将问题分成较小的部分,然后解决这些部分
110- * [ 二分查找] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/search/binary-search)
111- * [ 汉诺塔] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/uncategorized/hanoi-tower)
112- * [ 欧几里得算法] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/math/euclidean-algorithm) - 计算最大公约数(GCD)
113- * [ 排列] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/sets/permutations) (有/无重复)
114- * [ 组合] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/sets/combinations) (有/无重复)
115- * [ 归并排序] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/sorting/merge-sort)
116- * [ Quicksort] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/sorting/quick-sort)
117- * [ 树深度优先搜索] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/tree/depth-first-search) (DFS)
118- * [ 图深度优先搜索] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/graph/depth-first-search) (DFS)
110+ * [ 二分查找] ( src/algorithms/search/binary-search )
111+ * [ 汉诺塔] ( src/algorithms/uncategorized/hanoi-tower )
112+ * [ 欧几里得算法] ( src/algorithms/math/euclidean-algorithm ) - 计算最大公约数(GCD)
113+ * [ 排列] ( src/algorithms/sets/permutations ) (有/无重复)
114+ * [ 组合] ( src/algorithms/sets/combinations ) (有/无重复)
115+ * [ 归并排序] ( src/algorithms/sorting/merge-sort )
116+ * [ Quicksort] ( src/algorithms/sorting/quick-sort )
117+ * [ 树深度优先搜索] ( src/algorithms/tree/depth-first-search ) (DFS)
118+ * [ 图深度优先搜索] ( src/algorithms/graph/depth-first-search ) (DFS)
119119* ** 动态编程** - 使用以前找到的子解决方案构建解决方案
120- * [ 斐波那契数] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/math/fibonacci)
121- * [ 莱温斯坦距离] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/string/levenshtein-distance) - 两个序列之间的最小编辑距离
122- * [ 最长公共子序列] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/sets/longest-common-subsequnce ) (LCS)
123- * [ 最长公共子串] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/string/longest-common-substring)
124- * [ 最长递增子序列] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/sets/longest-increasing-subsequence)
125- * [ 最短公共子序列] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/sets/shortest-common-supersequence)
126- * [ 0-1背包问题] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/sets/knapsack-problem)
127- * [ 整数拆分] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/math/integer-partition)
128- * [ 最大子数列] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/sets/maximum-subarray)
129- * [ 贝尔曼-福特算法] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/graph/bellman-ford) - 找到所有图顶点的最短路径
120+ * [ 斐波那契数] ( src/algorithms/math/fibonacci )
121+ * [ 莱温斯坦距离] ( src/algorithms/string/levenshtein-distance ) - 两个序列之间的最小编辑距离
122+ * [ 最长公共子序列] ( src/algorithms/sets/longest-common-subsequence ) (LCS)
123+ * [ 最长公共子串] ( src/algorithms/string/longest-common-substring )
124+ * [ 最长递增子序列] ( src/algorithms/sets/longest-increasing-subsequence )
125+ * [ 最短公共子序列] ( src/algorithms/sets/shortest-common-supersequence )
126+ * [ 0-1背包问题] ( src/algorithms/sets/knapsack-problem )
127+ * [ 整数拆分] ( src/algorithms/math/integer-partition )
128+ * [ 最大子数列] ( src/algorithms/sets/maximum-subarray )
129+ * [ 贝尔曼-福特算法] ( src/algorithms/graph/bellman-ford ) - 找到所有图顶点的最短路径
130130* ** 回溯法** - 类似于 BF算法 试图产生所有可能的解决方案,但每次生成解决方案测试如果它满足所有条件,那么只有继续生成后续解决方案。 否则回溯并继续寻找不同路径的解决方案。
131- * [ 哈密顿图] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/graph/hamiltonian-cycle) - 恰好访问每个顶点一次
132- * [ 八皇后问题] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/uncategorized/n-queens)
133- * [ 骑士巡逻] ( https://github.com/trekhleb/javascript-algorithms/tree/master/ src/algorithms/uncategorized/knight-tour)
131+ * [ 哈密顿图] ( src/algorithms/graph/hamiltonian-cycle ) - 恰好访问每个顶点一次
132+ * [ 八皇后问题] ( src/algorithms/uncategorized/n-queens )
133+ * [ 骑士巡逻] ( src/algorithms/uncategorized/knight-tour )
134134* ** B & B**
135135
136136## 如何使用本仓库
0 commit comments