diff --git a/README.es-ES.md b/README.es-ES.md
index 76c30b19f8..a1d013bc2b 100644
--- a/README.es-ES.md
+++ b/README.es-ES.md
@@ -6,7 +6,7 @@
Este repositorio contiene ejemplos basados en JavaScript de muchos
algoritmos y estructuras de datos populares.
-Cada algoritmo y estructura de datos tiene su propio LÉAME con explicaciones relacionadas y
+Cada algoritmo y estructura de datos tiene su propio LÉAME con explicaciones relacionadas y
enlaces para lecturas adicionales (incluyendo algunas a vídeos de YouTube).
_Léelo en otros idiomas:_
@@ -17,10 +17,11 @@ _Léelo en otros idiomas:_
[_日本語_](README.ja-JP.md),
[_Polski_](README.pl-PL.md),
[_Français_](README.fr-FR.md),
-[_Português_](README.pt-BR.md)
+[_Português_](README.pt-BR.md),
+[_Русский_](README.ru-RU.md)
-*☝ Nótese que este proyecto está pensado con fines de aprendizaje e investigación,
-y **no** para ser usado en producción.*
+_☝ Nótese que este proyecto está pensado con fines de aprendizaje e investigación,
+y **no** para ser usado en producción._
## Estructuras de Datos
@@ -31,172 +32,172 @@ los datos.
`P` - Principiante, `A` - Avanzado
-* `P` [Lista enlazada](src/data-structures/linked-list)
-* `P` [Lista doblemente enlazada](src/data-structures/doubly-linked-list)
-* `P` [Cola](src/data-structures/queue)
-* `P` [Pila](src/data-structures/stack)
-* `P` [Tabla hash](src/data-structures/hash-table)
-* `P` [Heap](src/data-structures/heap) - versiones máx y mín
-* `P` [Cola de prioridad](src/data-structures/priority-queue)
-* `A` [Trie](src/data-structures/trie)
-* `A` [Árbol](src/data-structures/tree)
- * `A` [Árbol de búsqueda binaria](src/data-structures/tree/binary-search-tree)
- * `A` [Árbol AVL](src/data-structures/tree/avl-tree)
- * `A` [Árbol Rojo-Negro](src/data-structures/tree/red-black-tree)
- * `A` [Árbol de segmentos](src/data-structures/tree/segment-tree) - con ejemplos de consultas de rango mín/máx/suma
- * `A` [Árbol de Fenwick](src/data-structures/tree/fenwick-tree) (Árbol binario indexado)
-* `A` [Grafo](src/data-structures/graph) (dirigido y no dirigido)
-* `A` [Conjuntos disjuntos](src/data-structures/disjoint-set)
-* `A` [Filtro de Bloom](src/data-structures/bloom-filter)
+- `P` [Lista enlazada](src/data-structures/linked-list)
+- `P` [Lista doblemente enlazada](src/data-structures/doubly-linked-list)
+- `P` [Cola](src/data-structures/queue)
+- `P` [Pila](src/data-structures/stack)
+- `P` [Tabla hash](src/data-structures/hash-table)
+- `P` [Heap](src/data-structures/heap) - versiones máx y mín
+- `P` [Cola de prioridad](src/data-structures/priority-queue)
+- `A` [Trie](src/data-structures/trie)
+- `A` [Árbol](src/data-structures/tree)
+ - `A` [Árbol de búsqueda binaria](src/data-structures/tree/binary-search-tree)
+ - `A` [Árbol AVL](src/data-structures/tree/avl-tree)
+ - `A` [Árbol Rojo-Negro](src/data-structures/tree/red-black-tree)
+ - `A` [Árbol de segmentos](src/data-structures/tree/segment-tree) - con ejemplos de consultas de rango mín/máx/suma
+ - `A` [Árbol de Fenwick](src/data-structures/tree/fenwick-tree) (Árbol binario indexado)
+- `A` [Grafo](src/data-structures/graph) (dirigido y no dirigido)
+- `A` [Conjuntos disjuntos](src/data-structures/disjoint-set)
+- `A` [Filtro de Bloom](src/data-structures/bloom-filter)
## Algoritmos
-Un algoritmo es una especificación inequívoca de cómo resolver una clase de problemas. Es un conjunto de reglas que
+Un algoritmo es una especificación inequívoca de cómo resolver una clase de problemas. Es un conjunto de reglas que
definen con precisión una secuencia de operaciones.
`P` - Principiante, `A` - Avanzado
### Algoritmos por Tema
-* **Matemáticas**
- * `P` [Manipulación de bits](src/algorithms/math/bits) - asignar/obtener/actualizar/limpiar bits, multiplicación/división por dos, hacer negativo, etc.
- * `P` [Factorial](src/algorithms/math/factorial)
- * `P` [Número de Fibonacci](src/algorithms/math/fibonacci)
- * `P` [Prueba de primalidad](src/algorithms/math/primality-test) (método de división de prueba)
- * `P` [Algoritmo de Euclides](src/algorithms/math/euclidean-algorithm) - calcular el Máximo común divisor (MCD)
- * `P` [Mínimo común múltiplo](src/algorithms/math/least-common-multiple) (MCM)
- * `P` [Criba de Eratóstenes](src/algorithms/math/sieve-of-eratosthenes) - encontrar todos los números primos hasta un límite dado
- * `P` [Es una potencia de dos?](src/algorithms/math/is-power-of-two) - comprobar si el número es una potencia de dos (algoritmos ingenuos y de bits)
- * `P` [Triángulo de Pascal](src/algorithms/math/pascal-triangle)
- * `P` [Números complejos](src/algorithms/math/complex-number) - números complejos y operaciones con ellos
- * `P` [Radianes & Grados](src/algorithms/math/radian) - conversión de radianes a grados y viceversa
- * `P` [Exponenciación rápida](src/algorithms/math/fast-powering)
- * `A` [Partición entera](src/algorithms/math/integer-partition)
- * `A` [Algortimo π de Liu Hui](src/algorithms/math/liu-hui) - aproximar el cálculo de π basado en polígonos de N lados
- * `A` [Transformada discreta de Fourier](src/algorithms/math/fourier-transform) - descomponer una función de tiempo (señal) en las frecuencias que la componen
-* **Conjuntos**
- * `P` [Producto cartesiano](src/algorithms/sets/cartesian-product) - producto de múltiples conjuntos
- * `P` [Permutación de Fisher–Yates](src/algorithms/sets/fisher-yates) - permutación aleatoria de una secuencia finita
- * `A` [Conjunto potencia](src/algorithms/sets/power-set) - todos los subconjuntos de un conjunto
- * `A` [Permutaciones](src/algorithms/sets/permutations) (con y sin repeticiones)
- * `A` [Combinaciones](src/algorithms/sets/combinations) (con y sin repeticiones)
- * `A` [Subsecuencia común más larga](src/algorithms/sets/longest-common-subsequence) (LCS)
- * `A` [Subsecuencia creciente más larga](src/algorithms/sets/longest-increasing-subsequence)
- * `A` [Supersecuencia común más corta](src/algorithms/sets/shortest-common-supersequence) (SCS)
- * `A` [Problema de la mochila](src/algorithms/sets/knapsack-problem) - "0/1" y "sin límite"
- * `A` [Máximo subarreglo](src/algorithms/sets/maximum-subarray) - versiones de "fuerza bruta" y "programación dinámica" (de Kadane)
- * `A` [Suma combinada](src/algorithms/sets/combination-sum) - encuentra todas las combinaciones que forman una suma específica
-* **Cadenas de caracteres**
- * `P` [Distancia de Hamming](src/algorithms/string/hamming-distance) - número de posiciones en las que los símbolos son diferentes
- * `A` [Distancia de Levenshtein](src/algorithms/string/levenshtein-distance) - distancia mínima de edición entre dos secuencias
- * `A` [Algoritmo Knuth-Morris-Pratt](src/algorithms/string/knuth-morris-pratt) (Algoritmo KMP) - búsqueda de subcadenas (coincidencia de patrones)
- * `A` [Algoritmo Z](src/algorithms/string/z-algorithm) - búsqueda de subcadenas (coincidencia de patrones)
- * `A` [Algoritmo de Rabin Karp](src/algorithms/string/rabin-karp) - búsqueda de subcadenas
- * `A` [Subcadena común más larga](src/algorithms/string/longest-common-substring)
- * `A` [Coincidencia por expresiones regulares](src/algorithms/string/regular-expression-matching)
-* **Búsquedas**
- * `P` [Búsqueda lineal](src/algorithms/search/linear-search)
- * `P` [Búsqueda de salto](src/algorithms/search/jump-search) (o Búsqueda de bloque) - búsqueda en una lista ordenada
- * `P` [Búsqueda binaria](src/algorithms/search/binary-search) - búsqueda en una lista ordenada
- * `P` [Búsqueda por interpolación](src/algorithms/search/interpolation-search) - búsqueda en una lista ordenada uniformemente distribuida
-* **Ordenamiento**
- * `P` [Ordenamiento de burbuja](src/algorithms/sorting/bubble-sort)
- * `P` [Ordenamiento por selección](src/algorithms/sorting/selection-sort)
- * `P` [Ordenamiento por inserción](src/algorithms/sorting/insertion-sort)
- * `P` [Ordenamiento por Heap](src/algorithms/sorting/heap-sort)
- * `P` [Ordenamiento por mezcla](src/algorithms/sorting/merge-sort)
- * `P` [Quicksort](src/algorithms/sorting/quick-sort) - implementaciones in situ y no in situ
- * `P` [Shellsort](src/algorithms/sorting/shell-sort)
- * `P` [Ordenamiento por cuentas](src/algorithms/sorting/counting-sort)
- * `P` [Ordenamiento Radix](src/algorithms/sorting/radix-sort)
-* **Listas enlazadas**
- * `P` [Recorrido directo](src/algorithms/linked-list/traversal)
- * `P` [Recorrido inverso](src/algorithms/linked-list/reverse-traversal)
-* **Árboles**
- * `P` [Búsqueda en profundidad](src/algorithms/tree/depth-first-search) (DFS)
- * `P` [Búsqueda en anchura](src/algorithms/tree/breadth-first-search) (BFS)
-* **Grafos**
- * `P` [Búsqueda en profundidad](src/algorithms/graph/depth-first-search) (DFS)
- * `P` [Búsqueda en anchura](src/algorithms/graph/breadth-first-search) (BFS)
- * `P` [Algoritmo de Kruskal](src/algorithms/graph/kruskal) - encontrar el árbol de cubrimiento mínimo (MST) para un grafo no dirigido ponderado
- * `A` [Algoritmo de Dijkstra](src/algorithms/graph/dijkstra) - encontrar los caminos más cortos a todos los vértices del grafo desde un solo vértice
- * `A` [Algoritmo de Bellman-Ford](src/algorithms/graph/bellman-ford) - encontrar los caminos más cortos a todos los vértices del grafo desde un solo vértice
- * `A` [Algortimo de Floyd-Warshall](src/algorithms/graph/floyd-warshall) - encontrar los caminos más cortos entre todos los pares de vértices
- * `A` [Detectar ciclos](src/algorithms/graph/detect-cycle) - para grafos dirigidos y no dirigidos (versiones basadas en DFS y conjuntos disjuntos)
- * `A` [Algoritmo de Prim](src/algorithms/graph/prim) - encontrar el árbol de cubrimiento mínimo (MST) para un grafo no dirigido ponderado
- * `A` [Ordenamiento topológico](src/algorithms/graph/topological-sorting) - método DFS
- * `A` [Puntos de articulación](src/algorithms/graph/articulation-points) - algoritmo de Tarjan (basado en DFS)
- * `A` [Puentes](src/algorithms/graph/bridges) - algoritmo basado en DFS
- * `A` [Camino euleriano y circuito euleriano](src/algorithms/graph/eulerian-path) - algoritmo de Fleury - visitar cada arista exactamente una vez
- * `A` [Ciclo hamiltoniano](src/algorithms/graph/hamiltonian-cycle) - visitar cada vértice exactamente una vez
- * `A` [Componentes fuertemente conexos](src/algorithms/graph/strongly-connected-components) - algoritmo de Kosaraju
- * `A` [Problema del viajante](src/algorithms/graph/travelling-salesman) - la ruta más corta posible que visita cada ciudad y vuelve a la ciudad de origen
-* **Criptografia**
- * `P` [Hash polinomial](src/algorithms/cryptography/polynomial-hash) - función de hash rodante basada en polinomio
-* **Sin categoría**
- * `P` [Torre de Hanói](src/algorithms/uncategorized/hanoi-tower)
- * `P` [Rotación de matriz cuadrada](src/algorithms/uncategorized/square-matrix-rotation) - algoritmo in situ
- * `P` [Juego de los saltos](src/algorithms/uncategorized/jump-game) - ejemplos de backtracking, programación dinámica (de arriba hacia abajo + de abajo hacia arriba) y voraces
- * `P` [Caminos únicos](src/algorithms/uncategorized/unique-paths) - ejemplos de backtracking, programación dinámica y basados en el Triángulo de Pascal
- * `P` [Terrazas pluviales](src/algorithms/uncategorized/rain-terraces) - el problema de la retención del agua de lluvia (programación dinámica y fuerza bruta)
- * `A` [Problema de las N Reinas](src/algorithms/uncategorized/n-queens)
- * `A` [Problema del caballo (Knight tour)](src/algorithms/uncategorized/knight-tour)
+- **Matemáticas**
+ - `P` [Manipulación de bits](src/algorithms/math/bits) - asignar/obtener/actualizar/limpiar bits, multiplicación/división por dos, hacer negativo, etc.
+ - `P` [Factorial](src/algorithms/math/factorial)
+ - `P` [Número de Fibonacci](src/algorithms/math/fibonacci)
+ - `P` [Prueba de primalidad](src/algorithms/math/primality-test) (método de división de prueba)
+ - `P` [Algoritmo de Euclides](src/algorithms/math/euclidean-algorithm) - calcular el Máximo común divisor (MCD)
+ - `P` [Mínimo común múltiplo](src/algorithms/math/least-common-multiple) (MCM)
+ - `P` [Criba de Eratóstenes](src/algorithms/math/sieve-of-eratosthenes) - encontrar todos los números primos hasta un límite dado
+ - `P` [Es una potencia de dos?](src/algorithms/math/is-power-of-two) - comprobar si el número es una potencia de dos (algoritmos ingenuos y de bits)
+ - `P` [Triángulo de Pascal](src/algorithms/math/pascal-triangle)
+ - `P` [Números complejos](src/algorithms/math/complex-number) - números complejos y operaciones con ellos
+ - `P` [Radianes & Grados](src/algorithms/math/radian) - conversión de radianes a grados y viceversa
+ - `P` [Exponenciación rápida](src/algorithms/math/fast-powering)
+ - `A` [Partición entera](src/algorithms/math/integer-partition)
+ - `A` [Algortimo π de Liu Hui](src/algorithms/math/liu-hui) - aproximar el cálculo de π basado en polígonos de N lados
+ - `A` [Transformada discreta de Fourier](src/algorithms/math/fourier-transform) - descomponer una función de tiempo (señal) en las frecuencias que la componen
+- **Conjuntos**
+ - `P` [Producto cartesiano](src/algorithms/sets/cartesian-product) - producto de múltiples conjuntos
+ - `P` [Permutación de Fisher–Yates](src/algorithms/sets/fisher-yates) - permutación aleatoria de una secuencia finita
+ - `A` [Conjunto potencia](src/algorithms/sets/power-set) - todos los subconjuntos de un conjunto
+ - `A` [Permutaciones](src/algorithms/sets/permutations) (con y sin repeticiones)
+ - `A` [Combinaciones](src/algorithms/sets/combinations) (con y sin repeticiones)
+ - `A` [Subsecuencia común más larga](src/algorithms/sets/longest-common-subsequence) (LCS)
+ - `A` [Subsecuencia creciente más larga](src/algorithms/sets/longest-increasing-subsequence)
+ - `A` [Supersecuencia común más corta](src/algorithms/sets/shortest-common-supersequence) (SCS)
+ - `A` [Problema de la mochila](src/algorithms/sets/knapsack-problem) - "0/1" y "sin límite"
+ - `A` [Máximo subarreglo](src/algorithms/sets/maximum-subarray) - versiones de "fuerza bruta" y "programación dinámica" (de Kadane)
+ - `A` [Suma combinada](src/algorithms/sets/combination-sum) - encuentra todas las combinaciones que forman una suma específica
+- **Cadenas de caracteres**
+ - `P` [Distancia de Hamming](src/algorithms/string/hamming-distance) - número de posiciones en las que los símbolos son diferentes
+ - `A` [Distancia de Levenshtein](src/algorithms/string/levenshtein-distance) - distancia mínima de edición entre dos secuencias
+ - `A` [Algoritmo Knuth-Morris-Pratt](src/algorithms/string/knuth-morris-pratt) (Algoritmo KMP) - búsqueda de subcadenas (coincidencia de patrones)
+ - `A` [Algoritmo Z](src/algorithms/string/z-algorithm) - búsqueda de subcadenas (coincidencia de patrones)
+ - `A` [Algoritmo de Rabin Karp](src/algorithms/string/rabin-karp) - búsqueda de subcadenas
+ - `A` [Subcadena común más larga](src/algorithms/string/longest-common-substring)
+ - `A` [Coincidencia por expresiones regulares](src/algorithms/string/regular-expression-matching)
+- **Búsquedas**
+ - `P` [Búsqueda lineal](src/algorithms/search/linear-search)
+ - `P` [Búsqueda de salto](src/algorithms/search/jump-search) (o Búsqueda de bloque) - búsqueda en una lista ordenada
+ - `P` [Búsqueda binaria](src/algorithms/search/binary-search) - búsqueda en una lista ordenada
+ - `P` [Búsqueda por interpolación](src/algorithms/search/interpolation-search) - búsqueda en una lista ordenada uniformemente distribuida
+- **Ordenamiento**
+ - `P` [Ordenamiento de burbuja](src/algorithms/sorting/bubble-sort)
+ - `P` [Ordenamiento por selección](src/algorithms/sorting/selection-sort)
+ - `P` [Ordenamiento por inserción](src/algorithms/sorting/insertion-sort)
+ - `P` [Ordenamiento por Heap](src/algorithms/sorting/heap-sort)
+ - `P` [Ordenamiento por mezcla](src/algorithms/sorting/merge-sort)
+ - `P` [Quicksort](src/algorithms/sorting/quick-sort) - implementaciones in situ y no in situ
+ - `P` [Shellsort](src/algorithms/sorting/shell-sort)
+ - `P` [Ordenamiento por cuentas](src/algorithms/sorting/counting-sort)
+ - `P` [Ordenamiento Radix](src/algorithms/sorting/radix-sort)
+- **Listas enlazadas**
+ - `P` [Recorrido directo](src/algorithms/linked-list/traversal)
+ - `P` [Recorrido inverso](src/algorithms/linked-list/reverse-traversal)
+- **Árboles**
+ - `P` [Búsqueda en profundidad](src/algorithms/tree/depth-first-search) (DFS)
+ - `P` [Búsqueda en anchura](src/algorithms/tree/breadth-first-search) (BFS)
+- **Grafos**
+ - `P` [Búsqueda en profundidad](src/algorithms/graph/depth-first-search) (DFS)
+ - `P` [Búsqueda en anchura](src/algorithms/graph/breadth-first-search) (BFS)
+ - `P` [Algoritmo de Kruskal](src/algorithms/graph/kruskal) - encontrar el árbol de cubrimiento mínimo (MST) para un grafo no dirigido ponderado
+ - `A` [Algoritmo de Dijkstra](src/algorithms/graph/dijkstra) - encontrar los caminos más cortos a todos los vértices del grafo desde un solo vértice
+ - `A` [Algoritmo de Bellman-Ford](src/algorithms/graph/bellman-ford) - encontrar los caminos más cortos a todos los vértices del grafo desde un solo vértice
+ - `A` [Algortimo de Floyd-Warshall](src/algorithms/graph/floyd-warshall) - encontrar los caminos más cortos entre todos los pares de vértices
+ - `A` [Detectar ciclos](src/algorithms/graph/detect-cycle) - para grafos dirigidos y no dirigidos (versiones basadas en DFS y conjuntos disjuntos)
+ - `A` [Algoritmo de Prim](src/algorithms/graph/prim) - encontrar el árbol de cubrimiento mínimo (MST) para un grafo no dirigido ponderado
+ - `A` [Ordenamiento topológico](src/algorithms/graph/topological-sorting) - método DFS
+ - `A` [Puntos de articulación](src/algorithms/graph/articulation-points) - algoritmo de Tarjan (basado en DFS)
+ - `A` [Puentes](src/algorithms/graph/bridges) - algoritmo basado en DFS
+ - `A` [Camino euleriano y circuito euleriano](src/algorithms/graph/eulerian-path) - algoritmo de Fleury - visitar cada arista exactamente una vez
+ - `A` [Ciclo hamiltoniano](src/algorithms/graph/hamiltonian-cycle) - visitar cada vértice exactamente una vez
+ - `A` [Componentes fuertemente conexos](src/algorithms/graph/strongly-connected-components) - algoritmo de Kosaraju
+ - `A` [Problema del viajante](src/algorithms/graph/travelling-salesman) - la ruta más corta posible que visita cada ciudad y vuelve a la ciudad de origen
+- **Criptografia**
+ - `P` [Hash polinomial](src/algorithms/cryptography/polynomial-hash) - función de hash rodante basada en polinomio
+- **Sin categoría**
+ - `P` [Torre de Hanói](src/algorithms/uncategorized/hanoi-tower)
+ - `P` [Rotación de matriz cuadrada](src/algorithms/uncategorized/square-matrix-rotation) - algoritmo in situ
+ - `P` [Juego de los saltos](src/algorithms/uncategorized/jump-game) - ejemplos de backtracking, programación dinámica (de arriba hacia abajo + de abajo hacia arriba) y voraces
+ - `P` [Caminos únicos](src/algorithms/uncategorized/unique-paths) - ejemplos de backtracking, programación dinámica y basados en el Triángulo de Pascal
+ - `P` [Terrazas pluviales](src/algorithms/uncategorized/rain-terraces) - el problema de la retención del agua de lluvia (programación dinámica y fuerza bruta)
+ - `A` [Problema de las N Reinas](src/algorithms/uncategorized/n-queens)
+ - `A` [Problema del caballo (Knight tour)](src/algorithms/uncategorized/knight-tour)
### Algoritmos por paradigma
Un paradigma algorítmico es un método o enfoque genérico que subyace al diseño de una clase de algoritmos.
Es una abstracción superior a la noción de algoritmo, del mismo modo que un algoritmo es una abstracción superior a un programa de ordenador.
-* **Fuerza Bruta** - mira todas las posibilidades y selecciona la mejor solución
- * `P` [Búsqueda lineal](src/algorithms/search/linear-search)
- * `P` [Terrazas pluviales](src/algorithms/uncategorized/rain-terraces) - el problema de la retención del agua de lluvia
- * `A` [Máximo subarreglo](src/algorithms/sets/maximum-subarray)
- * `A` [Problema del viajante](src/algorithms/graph/travelling-salesman) - la ruta más corta posible que visita cada ciudad y vuelve a la ciudad de origen
- * `A` [Transformada discreta de Fourier](src/algorithms/math/fourier-transform) - descomponer una función de tiempo (señal) en las frecuencias que la componen
-* **Voraces** - escoge la mejor opción en el momento actual, sin ninguna consideración sobre el futuro
- * `P` [Juego de los saltos](src/algorithms/uncategorized/jump-game)
- * `A` [Problema de la mochila sin límite](src/algorithms/sets/knapsack-problem)
- * `A` [Algoritmo de Dijkstra](src/algorithms/graph/dijkstra) - encontrar los caminos más cortos a todos los vértices del grafo desde un solo vértice
- * `A` [Algortimo de Prim](src/algorithms/graph/prim) - encontrar el árbol de cubrimiento mínimo (MST) para un grafo no dirigido ponderado
- * `A` [Algoritmo de Kruskal](src/algorithms/graph/kruskal) - encontrar el árbol de cubrimiento mínimo (MST) para un grafo no dirigido ponderado
-* **Divide y Vencerás** - divide el problema en partes más pequeñas y luego resuelve esas partes
- * `P` [Búsqueda binaria](src/algorithms/search/binary-search)
- * `P` [Torre de Hanói](src/algorithms/uncategorized/hanoi-tower)
- * `P` [Triángulo de Pascal](src/algorithms/math/pascal-triangle)
- * `P` [Algoritmo de Euclides](src/algorithms/math/euclidean-algorithm) - calcular el Máximo Común Divisor (MCD)
- * `P` [Ordenamiento por mezcla](src/algorithms/sorting/merge-sort)
- * `P` [Quicksort](src/algorithms/sorting/quick-sort)
- * `P` [Búsqueda en profundidad (árboles)](src/algorithms/tree/depth-first-search) - (DFS)
- * `P` [Búsqueda en profundidad (grafos)](src/algorithms/graph/depth-first-search) - (DFS)
- * `P` [Juego de los saltos](src/algorithms/uncategorized/jump-game)
- * `P` [Exponenciación rápida](src/algorithms/math/fast-powering)
- * `A` [Permutaciones](src/algorithms/sets/permutations) - (con y sin repeticiones)
- * `A` [Combinaciones](src/algorithms/sets/combinations) - (con y sin repeticiones)
-* **Programación Dinámica** - construye una solución usando sub-soluciones previamente encontradas
- * `P` [Número de Fibonacci](src/algorithms/math/fibonacci)
- * `P` [Juego de los saltos](src/algorithms/uncategorized/jump-game)
- * `P` [Caminos únicos](src/algorithms/uncategorized/unique-paths)
- * `P` [Terrazas pluviales](src/algorithms/uncategorized/rain-terraces) - el problema de la retención del agua de lluvia
- * `A` [Distancia de Levenshtein](src/algorithms/string/levenshtein-distance) - distancia mínima de edición entre dos secuencias
- * `A` [Subsecuencia común más larga](src/algorithms/sets/longest-common-subsequence) (LCS)
- * `A` [Subcadena común más larga](src/algorithms/string/longest-common-substring)
- * `A` [Subsecuencia creciente más larga](src/algorithms/sets/longest-increasing-subsequence)
- * `A` [Supersecuencia común más corta](src/algorithms/sets/shortest-common-supersequence)
- * `A` [Problema de la mochila 0/1](src/algorithms/sets/knapsack-problem)
- * `A` [Partición entera](src/algorithms/math/integer-partition)
- * `A` [Máximo subarreglo](src/algorithms/sets/maximum-subarray)
- * `A` [Algoritmo de Bellman-Ford](src/algorithms/graph/bellman-ford) - encontrar los caminos más cortos a todos los vértices del grafo desde un solo vértice
- * `A` [Algoritmo de Floyd-Warshall](src/algorithms/graph/floyd-warshall) - encontrar los caminos más cortos entre todos los pares de vértices
- * `A` [Coincidencia por expresiones regulares](src/algorithms/string/regular-expression-matching)
-* **De Retorceso (Backtracking)** - De manera similar a la fuerza bruta, trata de generar todas las soluciones posibles, pero cada vez que genere la siguiente solución, comprueba si cumple con todas las condiciones, y sólo entonces continúa generando soluciones posteriores. De lo contrario, retrocede y sigue un camino diferente para encontrar una solución. Normalmente se utiliza un recorrido en profundidad (DFS) del espacio de estados.
- * `P` [Juego de los saltos](src/algorithms/uncategorized/jump-game)
- * `P` [Caminos únicos](src/algorithms/uncategorized/unique-paths)
- * `P` [Conjunto potencia](src/algorithms/sets/power-set) - todos los subconjuntos de un conjunto
- * `A` [Ciclo hamiltoniano](src/algorithms/graph/hamiltonian-cycle) - visitar cada vértice exactamente una vez
- * `A` [Problema de las N Reinas](src/algorithms/uncategorized/n-queens)
- * `A` [Problema del caballo (Knight tour)](src/algorithms/uncategorized/knight-tour)
- * `A` [Suma combinada](src/algorithms/sets/combination-sum) - encuentra todas las combinaciones que forman una suma específica
-* **Ramas y Limites** - recuerda la solución de menor costo encontrada en cada etapa de la búsqueda de rastreo, y utilizar el costo de la solución de menor costo encontrada hasta el momento como un límite inferior del costo de una solución de menor costo para el problema, a fin de descartar soluciones parciales con costos mayores que la solución de menor costo encontrada hasta el momento. Normalmente se utiliza un recorrido BFS en combinación con un recorrido DFS del árbol del espacio de estados.
+- **Fuerza Bruta** - mira todas las posibilidades y selecciona la mejor solución
+ - `P` [Búsqueda lineal](src/algorithms/search/linear-search)
+ - `P` [Terrazas pluviales](src/algorithms/uncategorized/rain-terraces) - el problema de la retención del agua de lluvia
+ - `A` [Máximo subarreglo](src/algorithms/sets/maximum-subarray)
+ - `A` [Problema del viajante](src/algorithms/graph/travelling-salesman) - la ruta más corta posible que visita cada ciudad y vuelve a la ciudad de origen
+ - `A` [Transformada discreta de Fourier](src/algorithms/math/fourier-transform) - descomponer una función de tiempo (señal) en las frecuencias que la componen
+- **Voraces** - escoge la mejor opción en el momento actual, sin ninguna consideración sobre el futuro
+ - `P` [Juego de los saltos](src/algorithms/uncategorized/jump-game)
+ - `A` [Problema de la mochila sin límite](src/algorithms/sets/knapsack-problem)
+ - `A` [Algoritmo de Dijkstra](src/algorithms/graph/dijkstra) - encontrar los caminos más cortos a todos los vértices del grafo desde un solo vértice
+ - `A` [Algortimo de Prim](src/algorithms/graph/prim) - encontrar el árbol de cubrimiento mínimo (MST) para un grafo no dirigido ponderado
+ - `A` [Algoritmo de Kruskal](src/algorithms/graph/kruskal) - encontrar el árbol de cubrimiento mínimo (MST) para un grafo no dirigido ponderado
+- **Divide y Vencerás** - divide el problema en partes más pequeñas y luego resuelve esas partes
+ - `P` [Búsqueda binaria](src/algorithms/search/binary-search)
+ - `P` [Torre de Hanói](src/algorithms/uncategorized/hanoi-tower)
+ - `P` [Triángulo de Pascal](src/algorithms/math/pascal-triangle)
+ - `P` [Algoritmo de Euclides](src/algorithms/math/euclidean-algorithm) - calcular el Máximo Común Divisor (MCD)
+ - `P` [Ordenamiento por mezcla](src/algorithms/sorting/merge-sort)
+ - `P` [Quicksort](src/algorithms/sorting/quick-sort)
+ - `P` [Búsqueda en profundidad (árboles)](src/algorithms/tree/depth-first-search) - (DFS)
+ - `P` [Búsqueda en profundidad (grafos)](src/algorithms/graph/depth-first-search) - (DFS)
+ - `P` [Juego de los saltos](src/algorithms/uncategorized/jump-game)
+ - `P` [Exponenciación rápida](src/algorithms/math/fast-powering)
+ - `A` [Permutaciones](src/algorithms/sets/permutations) - (con y sin repeticiones)
+ - `A` [Combinaciones](src/algorithms/sets/combinations) - (con y sin repeticiones)
+- **Programación Dinámica** - construye una solución usando sub-soluciones previamente encontradas
+ - `P` [Número de Fibonacci](src/algorithms/math/fibonacci)
+ - `P` [Juego de los saltos](src/algorithms/uncategorized/jump-game)
+ - `P` [Caminos únicos](src/algorithms/uncategorized/unique-paths)
+ - `P` [Terrazas pluviales](src/algorithms/uncategorized/rain-terraces) - el problema de la retención del agua de lluvia
+ - `A` [Distancia de Levenshtein](src/algorithms/string/levenshtein-distance) - distancia mínima de edición entre dos secuencias
+ - `A` [Subsecuencia común más larga](src/algorithms/sets/longest-common-subsequence) (LCS)
+ - `A` [Subcadena común más larga](src/algorithms/string/longest-common-substring)
+ - `A` [Subsecuencia creciente más larga](src/algorithms/sets/longest-increasing-subsequence)
+ - `A` [Supersecuencia común más corta](src/algorithms/sets/shortest-common-supersequence)
+ - `A` [Problema de la mochila 0/1](src/algorithms/sets/knapsack-problem)
+ - `A` [Partición entera](src/algorithms/math/integer-partition)
+ - `A` [Máximo subarreglo](src/algorithms/sets/maximum-subarray)
+ - `A` [Algoritmo de Bellman-Ford](src/algorithms/graph/bellman-ford) - encontrar los caminos más cortos a todos los vértices del grafo desde un solo vértice
+ - `A` [Algoritmo de Floyd-Warshall](src/algorithms/graph/floyd-warshall) - encontrar los caminos más cortos entre todos los pares de vértices
+ - `A` [Coincidencia por expresiones regulares](src/algorithms/string/regular-expression-matching)
+- **De Retorceso (Backtracking)** - De manera similar a la fuerza bruta, trata de generar todas las soluciones posibles, pero cada vez que genere la siguiente solución, comprueba si cumple con todas las condiciones, y sólo entonces continúa generando soluciones posteriores. De lo contrario, retrocede y sigue un camino diferente para encontrar una solución. Normalmente se utiliza un recorrido en profundidad (DFS) del espacio de estados.
+ - `P` [Juego de los saltos](src/algorithms/uncategorized/jump-game)
+ - `P` [Caminos únicos](src/algorithms/uncategorized/unique-paths)
+ - `P` [Conjunto potencia](src/algorithms/sets/power-set) - todos los subconjuntos de un conjunto
+ - `A` [Ciclo hamiltoniano](src/algorithms/graph/hamiltonian-cycle) - visitar cada vértice exactamente una vez
+ - `A` [Problema de las N Reinas](src/algorithms/uncategorized/n-queens)
+ - `A` [Problema del caballo (Knight tour)](src/algorithms/uncategorized/knight-tour)
+ - `A` [Suma combinada](src/algorithms/sets/combination-sum) - encuentra todas las combinaciones que forman una suma específica
+- **Ramas y Limites** - recuerda la solución de menor costo encontrada en cada etapa de la búsqueda de rastreo, y utilizar el costo de la solución de menor costo encontrada hasta el momento como un límite inferior del costo de una solución de menor costo para el problema, a fin de descartar soluciones parciales con costos mayores que la solución de menor costo encontrada hasta el momento. Normalmente se utiliza un recorrido BFS en combinación con un recorrido DFS del árbol del espacio de estados.
## Cómo usar este repositorio
@@ -228,7 +229,7 @@ npm test -- 'LinkedList'
**Campo de juegos**
-Puede jugar con estructuras de datos y algoritmos en el archivo `./src/playground/playground.js` y escribir
+Puede jugar con estructuras de datos y algoritmos en el archivo `./src/playground/playground.js` y escribir
pruebas para ello en `./src/playground/__test__/playground.test.js`.
A continuación, simplemente ejecute el siguiente comando para comprobar si el código funciona como se espera:
@@ -251,7 +252,7 @@ Orden de crecimiento de los algoritmos especificados en la notación O grande.
Fuente: [Big O Cheat Sheet](http://bigocheatsheet.com/).
-A continuación se muestra la lista de algunas de las notaciones de Big O más utilizadas y sus comparaciones de rendimiento
+A continuación se muestra la lista de algunas de las notaciones de Big O más utilizadas y sus comparaciones de rendimiento
frente a diferentes tamaños de los datos de entrada.
| Notación O grande | Cálculos para 10 elementos | Cálculos para 100 elementos | Cálculos para 1000 elementos |
@@ -281,14 +282,14 @@ frente a diferentes tamaños de los datos de entrada.
### Complejidad de algoritmos de ordenamiento de arreglos
-| Nombre | Mejor | Promedio | Pero | Memorya | Estable | Comentarios |
-| -------------------------------- | :-----------: | :---------------------: | :-------------------------: | :-----: | :-----: | :------------------------------------------------------------ |
-| **Ordenamiento de burbuja** | n | n2 | n2 | 1 | Si | |
-| **Ordenamiento por inserción** | n | n2 | n2 | 1 | Si | |
-| **Ordenamiento por selección** | n2 | n2 | n2 | 1 | No | |
-| **Ordenamiento por Heap** | n log(n) | n log(n) | n log(n) | 1 | No | |
-| **Ordenamiento por mezcla** | n log(n) | n log(n) | n log(n) | n | Si | |
-| **Quicksort** | n log(n) | n log(n) | n2 | log(n) | No | Quicksort utiliza O(log(n)) de espacio en el stack |
-| **Shellsort** | n log(n) | depende de la secuencia de huecos | n (log(n))2 | 1 | No | |
-| **Ordenamiento por cuentas** | n + r | n + r | n + r | n + r | Si | r - mayor número en el arreglo |
-| **Ordenamiento Radix** | n \* k | n \* k | n \* k | n + k | Si | k - largo de la llave más larga |
+| Nombre | Mejor | Promedio | Pero | Memorya | Estable | Comentarios |
+| ------------------------------ | :-----------: | :-------------------------------: | :-------------------------: | :-----: | :-----: | :------------------------------------------------- |
+| **Ordenamiento de burbuja** | n | n2 | n2 | 1 | Si | |
+| **Ordenamiento por inserción** | n | n2 | n2 | 1 | Si | |
+| **Ordenamiento por selección** | n2 | n2 | n2 | 1 | No | |
+| **Ordenamiento por Heap** | n log(n) | n log(n) | n log(n) | 1 | No | |
+| **Ordenamiento por mezcla** | n log(n) | n log(n) | n log(n) | n | Si | |
+| **Quicksort** | n log(n) | n log(n) | n2 | log(n) | No | Quicksort utiliza O(log(n)) de espacio en el stack |
+| **Shellsort** | n log(n) | depende de la secuencia de huecos | n (log(n))2 | 1 | No | |
+| **Ordenamiento por cuentas** | n + r | n + r | n + r | n + r | Si | r - mayor número en el arreglo |
+| **Ordenamiento Radix** | n \* k | n \* k | n \* k | n + k | Si | k - largo de la llave más larga |
diff --git a/README.fr-FR.md b/README.fr-FR.md
index c522c591e3..a75aceec4d 100644
--- a/README.fr-FR.md
+++ b/README.fr-FR.md
@@ -3,11 +3,11 @@
[](https://travis-ci.org/trekhleb/javascript-algorithms)
[](https://codecov.io/gh/trekhleb/javascript-algorithms)
-Ce dépôt contient des exemples d'implémentation en JavaScript de plusieurs
+Ce dépôt contient des exemples d'implémentation en JavaScript de plusieurs
algorithmes et structures de données populaires.
-Chaque algorithme et structure de donnée possède son propre README contenant
-les explications détaillées et liens (incluant aussi des vidéos Youtube) pour
+Chaque algorithme et structure de donnée possède son propre README contenant
+les explications détaillées et liens (incluant aussi des vidéos Youtube) pour
complément d'informations.
_Lisez ceci dans d'autres langues:_
@@ -18,178 +18,180 @@ _Lisez ceci dans d'autres langues:_
[_日本語_](README.ja-JP.md),
[_Polski_](README.pl-PL.md),
[_Español_](README.es-ES.md),
-[_Português_](README.pt-BR.md)
+[_Português_](README.pt-BR.md),
+[_Русский_](README.ru-RU.md)
## Data Structures
-Une structure de données est une manière spéciale d'organiser et de stocker
-des données dans un ordinateur de manière à ce que l'on puisse accéder à
-cette information et la modifier de manière efficiente. De manière plus
-spécifique, une structure de données est un ensemble composé d'une collection
-de valeurs, des relations entre ces valeurs ainsi que d'un ensemble de
+Une structure de données est une manière spéciale d'organiser et de stocker
+des données dans un ordinateur de manière à ce que l'on puisse accéder à
+cette information et la modifier de manière efficiente. De manière plus
+spécifique, une structure de données est un ensemble composé d'une collection
+de valeurs, des relations entre ces valeurs ainsi que d'un ensemble de
fonctions ou d'opérations pouvant être appliquées sur ces données.
`B` - Débutant, `A` - Avancé
-* `B` [Liste Chaînée](src/data-structures/linked-list)
-* `B` [Liste Doublement Chaînée](src/data-structures/doubly-linked-list)
-* `B` [Queue](src/data-structures/queue)
-* `B` [Pile](src/data-structures/stack)
-* `B` [Table de Hachage](src/data-structures/hash-table)
-* `B` [Tas](src/data-structures/heap)
-* `B` [Queue de Priorité](src/data-structures/priority-queue)
-* `A` [Trie](src/data-structures/trie)
-* `A` [Arbre](src/data-structures/tree)
- * `A` [Arbre de recherche Binaire](src/data-structures/tree/binary-search-tree)
- * `A` [Arbre AVL](src/data-structures/tree/avl-tree)
- * `A` [Arbre Red-Black](src/data-structures/tree/red-black-tree)
- * `A` [Arbre de Segments](src/data-structures/tree/segment-tree) - avec exemples de requêtes de type min/max/somme sur intervalles
- * `A` [Arbre de Fenwick](src/data-structures/tree/fenwick-tree) (Arbre Binaire Indexé)
-* `A` [Graphe](src/data-structures/graph) (orienté et non orienté)
-* `A` [Ensembles Disjoints](src/data-structures/disjoint-set)
-* `A` [Filtre de Bloom](src/data-structures/bloom-filter)
+- `B` [Liste Chaînée](src/data-structures/linked-list)
+- `B` [Liste Doublement Chaînée](src/data-structures/doubly-linked-list)
+- `B` [Queue](src/data-structures/queue)
+- `B` [Pile](src/data-structures/stack)
+- `B` [Table de Hachage](src/data-structures/hash-table)
+- `B` [Tas](src/data-structures/heap)
+- `B` [Queue de Priorité](src/data-structures/priority-queue)
+- `A` [Trie](src/data-structures/trie)
+- `A` [Arbre](src/data-structures/tree)
+ - `A` [Arbre de recherche Binaire](src/data-structures/tree/binary-search-tree)
+ - `A` [Arbre AVL](src/data-structures/tree/avl-tree)
+ - `A` [Arbre Red-Black](src/data-structures/tree/red-black-tree)
+ - `A` [Arbre de Segments](src/data-structures/tree/segment-tree) - avec exemples de requêtes de type min/max/somme sur intervalles
+ - `A` [Arbre de Fenwick](src/data-structures/tree/fenwick-tree) (Arbre Binaire Indexé)
+- `A` [Graphe](src/data-structures/graph) (orienté et non orienté)
+- `A` [Ensembles Disjoints](src/data-structures/disjoint-set)
+- `A` [Filtre de Bloom](src/data-structures/bloom-filter)
## Algorithmes
-Un algorithme est une démarche non ambigüe expliquant comment résoudre une
-classe de problèmes. C'est un ensemble de règles décrivant de manière précise
+Un algorithme est une démarche non ambigüe expliquant comment résoudre une
+classe de problèmes. C'est un ensemble de règles décrivant de manière précise
une séquence d'opérations.
`B` - Débutant, `A` - Avancé
### Algorithmes par topic
-* **Math**
- * `B` [Manipulation de Bit](src/algorithms/math/bits) - définir/obtenir/mettre à jour/effacer les bits, multiplication/division par deux, négativiser etc.
- * `B` [Factorielle](src/algorithms/math/factorial)
- * `B` [Nombre de Fibonacci](src/algorithms/math/fibonacci)
- * `B` [Test de Primalité](src/algorithms/math/primality-test) (méthode du test de division)
- * `B` [Algorithme d'Euclide](src/algorithms/math/euclidean-algorithm) - calcule le Plus Grand Commun Diviseur (PGCD)
- * `B` [Plus Petit Commun Multiple](src/algorithms/math/least-common-multiple) (PPCM)
- * `B` [Crible d'Eratosthène](src/algorithms/math/sieve-of-eratosthenes) - trouve tous les nombres premiers inférieurs à une certaine limite
- * `B` [Puissance de Deux](src/algorithms/math/is-power-of-two) - teste si un nombre donné est une puissance de deux (algorithmes naif et basé sur les opérations bit-à-bit)
- * `B` [Triangle de Pascal](src/algorithms/math/pascal-triangle)
- * `A` [Partition Entière](src/algorithms/math/integer-partition)
- * `A` [Approximation de π par l'algorithme de Liu Hui](src/algorithms/math/liu-hui) - approximation du calcul de π basé sur les N-gons
-* **Ensembles**
- * `B` [Produit Cartésien](src/algorithms/sets/cartesian-product) - produit de plusieurs ensembles
- * `B` [Mélange de Fisher–Yates](src/algorithms/sets/fisher-yates) - permulation aléatoire d'une séquence finie
- * `A` [Ensemble des parties d'un ensemble](src/algorithms/sets/power-set) - tous les sous-ensembles d'un ensemble
- * `A` [Permutations](src/algorithms/sets/permutations) (avec et sans répétitions)
- * `A` [Combinaisons](src/algorithms/sets/combinations) (avec et sans répétitions)
- * `A` [Plus Longue Sous-séquence Commune](src/algorithms/sets/longest-common-subsequence)
- * `A` [Plus Longue Sous-suite strictement croissante](src/algorithms/sets/longest-increasing-subsequence)
- * `A` [Plus Courte Super-séquence Commune](src/algorithms/sets/shortest-common-supersequence)
- * `A` [Problème du Sac à Dos](src/algorithms/sets/knapsack-problem) - versions "0/1" et "Sans Contraintes"
- * `A` [Sous-partie Maximum](src/algorithms/sets/maximum-subarray) - versions "Force Brute" et "Programmation Dynamique" (Kadane)
- * `A` [Somme combinatoire](src/algorithms/sets/combination-sum) - trouve toutes les combinaisons qui forment une somme spécifique
-* **Chaînes de Caractères**
- * `B` [Distance de Hamming](src/algorithms/string/hamming-distance) - nombre de positions auxquelles les symboles sont différents
- * `A` [Distance de Levenshtein](src/algorithms/string/levenshtein-distance) - distance minimale d'édition entre deux séquences
- * `A` [Algorithme de Knuth–Morris–Pratt](src/algorithms/string/knuth-morris-pratt) (Algorithme KMP) - recherche de sous-chaîne (pattern matching)
- * `A` [Algorithme Z](src/algorithms/string/z-algorithm) - recherche de sous-chaîne (pattern matching)
- * `A` [Algorithme de Rabin Karp](src/algorithms/string/rabin-karp) - recherche de sous-chaîne
- * `A` [Plus Longue Sous-chaîne Commune](src/algorithms/string/longest-common-substring)
- * `A` [Expression Régulière](src/algorithms/string/regular-expression-matching)
-* **Recherche**
- * `B` [Recherche Linéaire](src/algorithms/search/linear-search)
- * `B` [Jump Search](src/algorithms/search/jump-search) Recherche par saut (ou par bloc) - recherche dans une liste triée
- * `B` [Recherche Binaire](src/algorithms/search/binary-search) - recherche dans une liste triée
- * `B` [Recherche par Interpolation](src/algorithms/search/interpolation-search) - recherche dans une liste triée et uniformément distribuée
-* **Tri**
- * `B` [Tri Bullet](src/algorithms/sorting/bubble-sort)
- * `B` [Tri Sélection](src/algorithms/sorting/selection-sort)
- * `B` [Tri Insertion](src/algorithms/sorting/insertion-sort)
- * `B` [Tri Par Tas](src/algorithms/sorting/heap-sort)
- * `B` [Tri Fusion](src/algorithms/sorting/merge-sort)
- * `B` [Tri Rapide](src/algorithms/sorting/quick-sort) - implémentations *in-place* et *non in-place*
- * `B` [Tri Shell](src/algorithms/sorting/shell-sort)
- * `B` [Tri Comptage](src/algorithms/sorting/counting-sort)
- * `B` [Tri Radix](src/algorithms/sorting/radix-sort)
-* **Arbres**
- * `B` [Parcours en Profondeur](src/algorithms/tree/depth-first-search) (DFS)
- * `B` [Parcours en Largeur](src/algorithms/tree/breadth-first-search) (BFS)
-* **Graphes**
- * `B` [Parcours en Profondeur](src/algorithms/graph/depth-first-search) (DFS)
- * `B` [Parcours en Largeur](src/algorithms/graph/breadth-first-search) (BFS)
- * `B` [Algorithme de Kruskal](src/algorithms/graph/kruskal) - trouver l'arbre couvrant de poids minimal sur un graphe pondéré non dirigé
- * `A` [Algorithme de Dijkstra](src/algorithms/graph/dijkstra) - trouver tous les plus courts chemins partant d'un noeud vers tous les autres noeuds dans un graphe
- * `A` [Algorithme de Bellman-Ford](src/algorithms/graph/bellman-ford) - trouver tous les plus courts chemins partant d'un noeud vers tous les autres noeuds dans un graphe
- * `A` [Algorithme de Floyd-Warshall](src/algorithms/graph/floyd-warshall) - trouver tous les plus courts chemins entre toutes les paires de noeuds dans un graphe
- * `A` [Détection de Cycle](src/algorithms/graph/detect-cycle) - pour les graphes dirigés et non dirigés (implémentations basées sur l'algorithme de Parcours en Profondeur et sur les Ensembles Disjoints)
- * `A` [Algorithme de Prim](src/algorithms/graph/prim) - trouver l'arbre couvrant de poids minimal sur un graphe pondéré non dirigé
- * `A` [Tri Topologique](src/algorithms/graph/topological-sorting) - méthode DFS
- * `A` [Point d'Articulation](src/algorithms/graph/articulation-points) - algorithme de Tarjan (basé sur l'algorithme de Parcours en Profondeur)
- * `A` [Bridges](src/algorithms/graph/bridges) - algorithme basé sur le Parcours en Profondeur
- * `A` [Chemin Eulérien et Circuit Eulérien](src/algorithms/graph/eulerian-path) - algorithme de Fleury - visite chaque arc exactement une fois
- * `A` [Cycle Hamiltonien](src/algorithms/graph/hamiltonian-cycle) - visite chaque noeud exactement une fois
- * `A` [Composants Fortements Connexes](src/algorithms/graph/strongly-connected-components) - algorithme de Kosaraju
- * `A` [Problème du Voyageur de Commerce](src/algorithms/graph/travelling-salesman) - chemin le plus court visitant chaque cité et retournant à la cité d'origine
-* **Non catégorisé**
- * `B` [Tours de Hanoi](src/algorithms/uncategorized/hanoi-tower)
- * `B` [Rotation de Matrice Carrée](src/algorithms/uncategorized/square-matrix-rotation) - algorithme *in place*
- * `B` [Jump Game](src/algorithms/uncategorized/jump-game) - retour sur trace, programmation dynamique (haut-bas + bas-haut) et exemples gourmands
- * `B` [Chemins Uniques](src/algorithms/uncategorized/unique-paths) - retour sur trace, programmation dynamique (haut-bas + bas-haut) et exemples basés sur le Triangle de Pascal
- * `A` [Problème des N-Dames](src/algorithms/uncategorized/n-queens)
- * `A` [Problème du Cavalier](src/algorithms/uncategorized/knight-tour)
+- **Math**
+ - `B` [Manipulation de Bit](src/algorithms/math/bits) - définir/obtenir/mettre à jour/effacer les bits, multiplication/division par deux, négativiser etc.
+ - `B` [Factorielle](src/algorithms/math/factorial)
+ - `B` [Nombre de Fibonacci](src/algorithms/math/fibonacci)
+ - `B` [Test de Primalité](src/algorithms/math/primality-test) (méthode du test de division)
+ - `B` [Algorithme d'Euclide](src/algorithms/math/euclidean-algorithm) - calcule le Plus Grand Commun Diviseur (PGCD)
+ - `B` [Plus Petit Commun Multiple](src/algorithms/math/least-common-multiple) (PPCM)
+ - `B` [Crible d'Eratosthène](src/algorithms/math/sieve-of-eratosthenes) - trouve tous les nombres premiers inférieurs à une certaine limite
+ - `B` [Puissance de Deux](src/algorithms/math/is-power-of-two) - teste si un nombre donné est une puissance de deux (algorithmes naif et basé sur les opérations bit-à-bit)
+ - `B` [Triangle de Pascal](src/algorithms/math/pascal-triangle)
+ - `A` [Partition Entière](src/algorithms/math/integer-partition)
+ - `A` [Approximation de π par l'algorithme de Liu Hui](src/algorithms/math/liu-hui) - approximation du calcul de π basé sur les N-gons
+- **Ensembles**
+ - `B` [Produit Cartésien](src/algorithms/sets/cartesian-product) - produit de plusieurs ensembles
+ - `B` [Mélange de Fisher–Yates](src/algorithms/sets/fisher-yates) - permulation aléatoire d'une séquence finie
+ - `A` [Ensemble des parties d'un ensemble](src/algorithms/sets/power-set) - tous les sous-ensembles d'un ensemble
+ - `A` [Permutations](src/algorithms/sets/permutations) (avec et sans répétitions)
+ - `A` [Combinaisons](src/algorithms/sets/combinations) (avec et sans répétitions)
+ - `A` [Plus Longue Sous-séquence Commune](src/algorithms/sets/longest-common-subsequence)
+ - `A` [Plus Longue Sous-suite strictement croissante](src/algorithms/sets/longest-increasing-subsequence)
+ - `A` [Plus Courte Super-séquence Commune](src/algorithms/sets/shortest-common-supersequence)
+ - `A` [Problème du Sac à Dos](src/algorithms/sets/knapsack-problem) - versions "0/1" et "Sans Contraintes"
+ - `A` [Sous-partie Maximum](src/algorithms/sets/maximum-subarray) - versions "Force Brute" et "Programmation Dynamique" (Kadane)
+ - `A` [Somme combinatoire](src/algorithms/sets/combination-sum) - trouve toutes les combinaisons qui forment une somme spécifique
+- **Chaînes de Caractères**
+ - `B` [Distance de Hamming](src/algorithms/string/hamming-distance) - nombre de positions auxquelles les symboles sont différents
+ - `A` [Distance de Levenshtein](src/algorithms/string/levenshtein-distance) - distance minimale d'édition entre deux séquences
+ - `A` [Algorithme de Knuth–Morris–Pratt](src/algorithms/string/knuth-morris-pratt) (Algorithme KMP) - recherche de sous-chaîne (pattern matching)
+ - `A` [Algorithme Z](src/algorithms/string/z-algorithm) - recherche de sous-chaîne (pattern matching)
+ - `A` [Algorithme de Rabin Karp](src/algorithms/string/rabin-karp) - recherche de sous-chaîne
+ - `A` [Plus Longue Sous-chaîne Commune](src/algorithms/string/longest-common-substring)
+ - `A` [Expression Régulière](src/algorithms/string/regular-expression-matching)
+- **Recherche**
+ - `B` [Recherche Linéaire](src/algorithms/search/linear-search)
+ - `B` [Jump Search](src/algorithms/search/jump-search) Recherche par saut (ou par bloc) - recherche dans une liste triée
+ - `B` [Recherche Binaire](src/algorithms/search/binary-search) - recherche dans une liste triée
+ - `B` [Recherche par Interpolation](src/algorithms/search/interpolation-search) - recherche dans une liste triée et uniformément distribuée
+- **Tri**
+ - `B` [Tri Bullet](src/algorithms/sorting/bubble-sort)
+ - `B` [Tri Sélection](src/algorithms/sorting/selection-sort)
+ - `B` [Tri Insertion](src/algorithms/sorting/insertion-sort)
+ - `B` [Tri Par Tas](src/algorithms/sorting/heap-sort)
+ - `B` [Tri Fusion](src/algorithms/sorting/merge-sort)
+ - `B` [Tri Rapide](src/algorithms/sorting/quick-sort) - implémentations _in-place_ et _non in-place_
+ - `B` [Tri Shell](src/algorithms/sorting/shell-sort)
+ - `B` [Tri Comptage](src/algorithms/sorting/counting-sort)
+ - `B` [Tri Radix](src/algorithms/sorting/radix-sort)
+- **Arbres**
+ - `B` [Parcours en Profondeur](src/algorithms/tree/depth-first-search) (DFS)
+ - `B` [Parcours en Largeur](src/algorithms/tree/breadth-first-search) (BFS)
+- **Graphes**
+ - `B` [Parcours en Profondeur](src/algorithms/graph/depth-first-search) (DFS)
+ - `B` [Parcours en Largeur](src/algorithms/graph/breadth-first-search) (BFS)
+ - `B` [Algorithme de Kruskal](src/algorithms/graph/kruskal) - trouver l'arbre couvrant de poids minimal sur un graphe pondéré non dirigé
+ - `A` [Algorithme de Dijkstra](src/algorithms/graph/dijkstra) - trouver tous les plus courts chemins partant d'un noeud vers tous les autres noeuds dans un graphe
+ - `A` [Algorithme de Bellman-Ford](src/algorithms/graph/bellman-ford) - trouver tous les plus courts chemins partant d'un noeud vers tous les autres noeuds dans un graphe
+ - `A` [Algorithme de Floyd-Warshall](src/algorithms/graph/floyd-warshall) - trouver tous les plus courts chemins entre toutes les paires de noeuds dans un graphe
+ - `A` [Détection de Cycle](src/algorithms/graph/detect-cycle) - pour les graphes dirigés et non dirigés (implémentations basées sur l'algorithme de Parcours en Profondeur et sur les Ensembles Disjoints)
+ - `A` [Algorithme de Prim](src/algorithms/graph/prim) - trouver l'arbre couvrant de poids minimal sur un graphe pondéré non dirigé
+ - `A` [Tri Topologique](src/algorithms/graph/topological-sorting) - méthode DFS
+ - `A` [Point d'Articulation](src/algorithms/graph/articulation-points) - algorithme de Tarjan (basé sur l'algorithme de Parcours en Profondeur)
+ - `A` [Bridges](src/algorithms/graph/bridges) - algorithme basé sur le Parcours en Profondeur
+ - `A` [Chemin Eulérien et Circuit Eulérien](src/algorithms/graph/eulerian-path) - algorithme de Fleury - visite chaque arc exactement une fois
+ - `A` [Cycle Hamiltonien](src/algorithms/graph/hamiltonian-cycle) - visite chaque noeud exactement une fois
+ - `A` [Composants Fortements Connexes](src/algorithms/graph/strongly-connected-components) - algorithme de Kosaraju
+ - `A` [Problème du Voyageur de Commerce](src/algorithms/graph/travelling-salesman) - chemin le plus court visitant chaque cité et retournant à la cité d'origine
+- **Non catégorisé**
+ - `B` [Tours de Hanoi](src/algorithms/uncategorized/hanoi-tower)
+ - `B` [Rotation de Matrice Carrée](src/algorithms/uncategorized/square-matrix-rotation) - algorithme _in place_
+ - `B` [Jump Game](src/algorithms/uncategorized/jump-game) - retour sur trace, programmation dynamique (haut-bas + bas-haut) et exemples gourmands
+ - `B` [Chemins Uniques](src/algorithms/uncategorized/unique-paths) - retour sur trace, programmation dynamique (haut-bas + bas-haut) et exemples basés sur le Triangle de Pascal
+ - `A` [Problème des N-Dames](src/algorithms/uncategorized/n-queens)
+ - `A` [Problème du Cavalier](src/algorithms/uncategorized/knight-tour)
### Algorithmes par Paradigme
-Un paradigme algorithmique est une méthode générique ou une approche qui
-sous-tend la conception d'une classe d'algorithmes. C'est une abstraction
-au-dessus de la notion d'algorithme, tout comme l'algorithme est une abstraction
+Un paradigme algorithmique est une méthode générique ou une approche qui
+sous-tend la conception d'une classe d'algorithmes. C'est une abstraction
+au-dessus de la notion d'algorithme, tout comme l'algorithme est une abstraction
supérieure à un programme informatique.
-* **Force Brute** - cherche parmi toutes les possibilités et retient la meilleure
- * `B` [Recherche Linéaire](src/algorithms/search/linear-search)
- * `A` [Sous-partie Maximum](src/algorithms/sets/maximum-subarray)
- * `A` [Problème du Voyageur de Commerce](src/algorithms/graph/travelling-salesman) - chemin le plus court visitant chaque cité et retournant à la cité d'origine
-* **Gourmand** - choisit la meilleure option à l'instant courant, sans tenir compte de la situation future
- * `B` [Jump Game](src/algorithms/uncategorized/jump-game)
- * `A` [Problème du Sac à Dos Sans Contraintes](src/algorithms/sets/knapsack-problem)
- * `A` [Algorithme de Dijkstra](src/algorithms/graph/dijkstra) - trouver tous les plus courts chemins partant d'un noeud vers tous les autres noeuds dans un graphe
- * `A` [Algorithme de Prim](src/algorithms/graph/prim) - trouver l'arbre couvrant de poids minimal sur un graphe pondéré non dirigé
- * `A` [Algorithme de Kruskal](src/algorithms/graph/kruskal) - trouver l'arbre couvrant de poids minimal sur un graphe pondéré non dirigé
-* **Diviser et Régner** - divise le problème en sous problèmes (plus simples) et résoud ces sous problèmes
- * `B` [Recherche Binaire](src/algorithms/search/binary-search)
- * `B` [Tours de Hanoi](src/algorithms/uncategorized/hanoi-tower)
- * `B` [Triangle de Pascal](src/algorithms/math/pascal-triangle)
- * `B` [Algorithme d'Euclide](src/algorithms/math/euclidean-algorithm) - calcule le Plus Grand Commun Diviseur (PGCD)
- * `B` [Tri Fusion](src/algorithms/sorting/merge-sort)
- * `B` [Tri Rapide](src/algorithms/sorting/quick-sort)
- * `B` [Arbre de Parcours en Profondeur](src/algorithms/tree/depth-first-search) (DFS)
- * `B` [Graphe de Parcours en Profondeur](src/algorithms/graph/depth-first-search) (DFS)
- * `B` [Jump Game](src/algorithms/uncategorized/jump-game)
- * `A` [Permutations](src/algorithms/sets/permutations) (avec et sans répétitions)
- * `A` [Combinations](src/algorithms/sets/combinations) (avec et sans répétitions)
-* **Programmation Dynamique** - construit une solution en utilisant les solutions précédemment trouvées
- * `B` [Nombre de Fibonacci](src/algorithms/math/fibonacci)
- * `B` [Jump Game](src/algorithms/uncategorized/jump-game)
- * `B` [Chemins Uniques](src/algorithms/uncategorized/unique-paths)
- * `A` [Distance de Levenshtein](src/algorithms/string/levenshtein-distance) - distance minimale d'édition entre deux séquences
- * `A` [Plus Longue Sous-séquence Commune](src/algorithms/sets/longest-common-subsequence)
- * `A` [Plus Longue Sous-chaîne Commune](src/algorithms/string/longest-common-substring)
- * `A` [Plus Longue Sous-suite strictement croissante](src/algorithms/sets/longest-increasing-subsequence)
- * `A` [Plus Courte Super-séquence Commune](src/algorithms/sets/shortest-common-supersequence)
- * `A` [Problème de Sac à Dos](src/algorithms/sets/knapsack-problem)
- * `A` [Partition Entière](src/algorithms/math/integer-partition)
- * `A` [Sous-partie Maximum](src/algorithms/sets/maximum-subarray)
- * `A` [Algorithme de Bellman-Ford](src/algorithms/graph/bellman-ford) - trouver tous les plus courts chemins partant d'un noeud vers tous les autres noeuds dans un graphe
- * `A` [Algorithme de Floyd-Warshall](src/algorithms/graph/floyd-warshall) - trouver tous les plus courts chemins entre toutes les paires de noeuds dans un graphe
- * `A` [Expression Régulière](src/algorithms/string/regular-expression-matching)
-* **Retour sur trace** - de même que la version "Force Brute", essaie de générer toutes les solutions possibles, mais pour chaque solution générée, on teste si elle satisfait toutes les conditions, et seulement ensuite continuer à générer des solutions ultérieures. Sinon, l'on revient en arrière, et l'on essaie un
-chemin différent pour tester d'autres solutions. Normalement, la traversée en profondeur de l'espace d'états est utilisée.
- * `B` [Jump Game](src/algorithms/uncategorized/jump-game)
- * `B` [Unique Paths](src/algorithms/uncategorized/unique-paths)
- * `A` [Hamiltonian Cycle](src/algorithms/graph/hamiltonian-cycle) - Visit every vertex exactly once
- * `A` [Problème des N-Dames](src/algorithms/uncategorized/n-queens)
- * `A` [Problème du Cavalier](src/algorithms/uncategorized/knight-tour)
- * `A` [Somme combinatoire](src/algorithms/sets/combination-sum) - trouve toutes les combinaisons qui forment une somme spécifique
-* **Séparation et Evaluation** - pemet de retenir une solution à moindre coût dans un ensemble. Pour chaque étape, l'on garde une trace de la solution la moins coûteuse trouvée jusqu'à présent en tant que borne inférieure du coût. Cela afin d'éliminer les solutions partielles dont les coûts sont plus élevés que celui de la solution actuelle retenue. Normalement, la traversée en largeur en combinaison avec la traversée en profondeur de l'espace d'états de l'arbre est utilisée.
+- **Force Brute** - cherche parmi toutes les possibilités et retient la meilleure
+ - `B` [Recherche Linéaire](src/algorithms/search/linear-search)
+ - `A` [Sous-partie Maximum](src/algorithms/sets/maximum-subarray)
+ - `A` [Problème du Voyageur de Commerce](src/algorithms/graph/travelling-salesman) - chemin le plus court visitant chaque cité et retournant à la cité d'origine
+- **Gourmand** - choisit la meilleure option à l'instant courant, sans tenir compte de la situation future
+ - `B` [Jump Game](src/algorithms/uncategorized/jump-game)
+ - `A` [Problème du Sac à Dos Sans Contraintes](src/algorithms/sets/knapsack-problem)
+ - `A` [Algorithme de Dijkstra](src/algorithms/graph/dijkstra) - trouver tous les plus courts chemins partant d'un noeud vers tous les autres noeuds dans un graphe
+ - `A` [Algorithme de Prim](src/algorithms/graph/prim) - trouver l'arbre couvrant de poids minimal sur un graphe pondéré non dirigé
+ - `A` [Algorithme de Kruskal](src/algorithms/graph/kruskal) - trouver l'arbre couvrant de poids minimal sur un graphe pondéré non dirigé
+- **Diviser et Régner** - divise le problème en sous problèmes (plus simples) et résoud ces sous problèmes
+ - `B` [Recherche Binaire](src/algorithms/search/binary-search)
+ - `B` [Tours de Hanoi](src/algorithms/uncategorized/hanoi-tower)
+ - `B` [Triangle de Pascal](src/algorithms/math/pascal-triangle)
+ - `B` [Algorithme d'Euclide](src/algorithms/math/euclidean-algorithm) - calcule le Plus Grand Commun Diviseur (PGCD)
+ - `B` [Tri Fusion](src/algorithms/sorting/merge-sort)
+ - `B` [Tri Rapide](src/algorithms/sorting/quick-sort)
+ - `B` [Arbre de Parcours en Profondeur](src/algorithms/tree/depth-first-search) (DFS)
+ - `B` [Graphe de Parcours en Profondeur](src/algorithms/graph/depth-first-search) (DFS)
+ - `B` [Jump Game](src/algorithms/uncategorized/jump-game)
+ - `A` [Permutations](src/algorithms/sets/permutations) (avec et sans répétitions)
+ - `A` [Combinations](src/algorithms/sets/combinations) (avec et sans répétitions)
+- **Programmation Dynamique** - construit une solution en utilisant les solutions précédemment trouvées
+ - `B` [Nombre de Fibonacci](src/algorithms/math/fibonacci)
+ - `B` [Jump Game](src/algorithms/uncategorized/jump-game)
+ - `B` [Chemins Uniques](src/algorithms/uncategorized/unique-paths)
+ - `A` [Distance de Levenshtein](src/algorithms/string/levenshtein-distance) - distance minimale d'édition entre deux séquences
+ - `A` [Plus Longue Sous-séquence Commune](src/algorithms/sets/longest-common-subsequence)
+ - `A` [Plus Longue Sous-chaîne Commune](src/algorithms/string/longest-common-substring)
+ - `A` [Plus Longue Sous-suite strictement croissante](src/algorithms/sets/longest-increasing-subsequence)
+ - `A` [Plus Courte Super-séquence Commune](src/algorithms/sets/shortest-common-supersequence)
+ - `A` [Problème de Sac à Dos](src/algorithms/sets/knapsack-problem)
+ - `A` [Partition Entière](src/algorithms/math/integer-partition)
+ - `A` [Sous-partie Maximum](src/algorithms/sets/maximum-subarray)
+ - `A` [Algorithme de Bellman-Ford](src/algorithms/graph/bellman-ford) - trouver tous les plus courts chemins partant d'un noeud vers tous les autres noeuds dans un graphe
+ - `A` [Algorithme de Floyd-Warshall](src/algorithms/graph/floyd-warshall) - trouver tous les plus courts chemins entre toutes les paires de noeuds dans un graphe
+ - `A` [Expression Régulière](src/algorithms/string/regular-expression-matching)
+- **Retour sur trace** - de même que la version "Force Brute", essaie de générer toutes les solutions possibles, mais pour chaque solution générée, on teste si elle satisfait toutes les conditions, et seulement ensuite continuer à générer des solutions ultérieures. Sinon, l'on revient en arrière, et l'on essaie un
+ chemin différent pour tester d'autres solutions. Normalement, la traversée en profondeur de l'espace d'états est utilisée.
+ - `B` [Jump Game](src/algorithms/uncategorized/jump-game)
+ - `B` [Unique Paths](src/algorithms/uncategorized/unique-paths)
+ - `A` [Hamiltonian Cycle](src/algorithms/graph/hamiltonian-cycle) - Visit every vertex exactly once
+ - `A` [Problème des N-Dames](src/algorithms/uncategorized/n-queens)
+ - `A` [Problème du Cavalier](src/algorithms/uncategorized/knight-tour)
+ - `A` [Somme combinatoire](src/algorithms/sets/combination-sum) - trouve toutes les combinaisons qui forment une somme spécifique
+- **Séparation et Evaluation** - pemet de retenir une solution à moindre coût dans un ensemble. Pour chaque étape, l'on garde une trace de la solution la moins coûteuse trouvée jusqu'à présent en tant que borne inférieure du coût. Cela afin d'éliminer les solutions partielles dont les coûts sont plus élevés que celui de la solution actuelle retenue. Normalement, la traversée en largeur en combinaison avec la traversée en profondeur de l'espace d'états de l'arbre est utilisée.
## Comment utiliser ce dépôt
**Installer toutes les dépendances**
+
```
npm install
```
@@ -203,22 +205,24 @@ npm run lint
```
**Exécuter tous les tests**
+
```
npm test
```
**Exécuter les tests par nom**
+
```
npm test -- 'LinkedList'
```
**Tests personnalisés**
-Vous pouvez manipuler les structures de données et algorithmes présents dans ce
-dépôt avec le fichier `./src/playground/playground.js` et écrire vos propres
+Vous pouvez manipuler les structures de données et algorithmes présents dans ce
+dépôt avec le fichier `./src/playground/playground.js` et écrire vos propres
tests dans file `./src/playground/__test__/playground.test.js`.
-Vous pourrez alors simplement exécuter la commande suivante afin de tester si
+Vous pourrez alors simplement exécuter la commande suivante afin de tester si
votre code fonctionne comme escompté
```
@@ -239,44 +243,44 @@ Comparaison de la performance d'algorithmes en notation Grand O.
Source: [Big O Cheat Sheet](http://bigocheatsheet.com/).
-Voici la liste de certaines des notations Grand O les plus utilisées et de leurs
+Voici la liste de certaines des notations Grand O les plus utilisées et de leurs
comparaisons de performance suivant différentes tailles pour les données d'entrée.
-| Notation Grand O | Opérations pour 10 éléments | Opérations pour 100 éléments | Opérations pour 1000 éléments |
-| ---------------- | ---------------------------- | ----------------------------- | ------------------------------- |
-| **O(1)** | 1 | 1 | 1 |
-| **O(log N)** | 3 | 6 | 9 |
-| **O(N)** | 10 | 100 | 1000 |
-| **O(N log N)** | 30 | 600 | 9000 |
-| **O(N^2)** | 100 | 10000 | 1000000 |
-| **O(2^N)** | 1024 | 1.26e+29 | 1.07e+301 |
-| **O(N!)** | 3628800 | 9.3e+157 | 4.02e+2567 |
+| Notation Grand O | Opérations pour 10 éléments | Opérations pour 100 éléments | Opérations pour 1000 éléments |
+| ---------------- | --------------------------- | ---------------------------- | ----------------------------- |
+| **O(1)** | 1 | 1 | 1 |
+| **O(log N)** | 3 | 6 | 9 |
+| **O(N)** | 10 | 100 | 1000 |
+| **O(N log N)** | 30 | 600 | 9000 |
+| **O(N^2)** | 100 | 10000 | 1000000 |
+| **O(2^N)** | 1024 | 1.26e+29 | 1.07e+301 |
+| **O(N!)** | 3628800 | 9.3e+157 | 4.02e+2567 |
### Complexité des Opérations suivant les Structures de Données
-| Structure de donnée | Accès | Recherche | Insertion | Suppression | Commentaires |
-| ------------------------------- | :-------: | :-------: | :-------: | :----------: | :------------ |
-| **Liste** | 1 | n | n | n | |
-| **Pile** | n | n | 1 | 1 | |
-| **Queue** | n | n | 1 | 1 | |
-| **Liste Liée** | n | n | 1 | 1 | |
-| **Table de Hachage** | - | n | n | n | Dans le cas des fonctions de hachage parfaites, les couts seraient de O(1) |
-| **Arbre de Recherche Binaire** | n | n | n | n | Dans le cas des arbre équilibrés, les coûts seraient de O(log(n)) |
-| **Arbre B** | log(n) | log(n) | log(n) | log(n) | |
-| **Arbre Red-Black** | log(n) | log(n) | log(n) | log(n) | |
-| **Arbre AVL** | log(n) | log(n) | log(n) | log(n) | |
-| **Filtre de Bloom** | - | 1 | 1 | - | Les faux positifs sont possibles lors de la recherche |
+| Structure de donnée | Accès | Recherche | Insertion | Suppression | Commentaires |
+| ------------------------------ | :----: | :-------: | :-------: | :---------: | :------------------------------------------------------------------------- |
+| **Liste** | 1 | n | n | n | |
+| **Pile** | n | n | 1 | 1 | |
+| **Queue** | n | n | 1 | 1 | |
+| **Liste Liée** | n | n | 1 | 1 | |
+| **Table de Hachage** | - | n | n | n | Dans le cas des fonctions de hachage parfaites, les couts seraient de O(1) |
+| **Arbre de Recherche Binaire** | n | n | n | n | Dans le cas des arbre équilibrés, les coûts seraient de O(log(n)) |
+| **Arbre B** | log(n) | log(n) | log(n) | log(n) | |
+| **Arbre Red-Black** | log(n) | log(n) | log(n) | log(n) | |
+| **Arbre AVL** | log(n) | log(n) | log(n) | log(n) | |
+| **Filtre de Bloom** | - | 1 | 1 | - | Les faux positifs sont possibles lors de la recherche |
### Complexité des Algorithmes de Tri de Liste
-| Nom | Meilleur | Moyenne | Pire | Mémoire | Stable | Commentaires |
-| ----------------------- | :-------------: | :--------------------: | :-----------------: | :-------: | :-------: | :------------ |
-| **Tri Bulle** | n | n2 | n2 | 1 | Oui | |
-| **Tri Insertion** | n | n2 | n2 | 1 | Oui | |
-| **Tri Sélection** | n2 | n2 | n2 | 1 | Non | |
-| **Tri par Tas** | n log(n) | n log(n) | n log(n) | 1 | Non | |
-| **Merge sort** | n log(n) | n log(n) | n log(n) | n | Oui | |
-| **Tri Rapide** | n log(n) | n log(n) | n2 | log(n) | Non | le Tri Rapide est généralement effectué *in-place* avec une pile de taille O(log(n)) |
-| **Tri Shell** | n log(n) | dépend du gap séquence | n (log(n))2 | 1 | Non | |
-| **Tri Comptage** | n + r | n + r | n + r | n + r | Oui | r - le plus grand nombre dans la liste |
-| **Tri Radix** | n * k | n * k | n * k | n + k | Non | k - longueur du plus long index |
+| Nom | Meilleur | Moyenne | Pire | Mémoire | Stable | Commentaires |
+| ----------------- | :-----------: | :--------------------: | :-------------------------: | :-----: | :----: | :----------------------------------------------------------------------------------- |
+| **Tri Bulle** | n | n2 | n2 | 1 | Oui | |
+| **Tri Insertion** | n | n2 | n2 | 1 | Oui | |
+| **Tri Sélection** | n2 | n2 | n2 | 1 | Non | |
+| **Tri par Tas** | n log(n) | n log(n) | n log(n) | 1 | Non | |
+| **Merge sort** | n log(n) | n log(n) | n log(n) | n | Oui | |
+| **Tri Rapide** | n log(n) | n log(n) | n2 | log(n) | Non | le Tri Rapide est généralement effectué _in-place_ avec une pile de taille O(log(n)) |
+| **Tri Shell** | n log(n) | dépend du gap séquence | n (log(n))2 | 1 | Non | |
+| **Tri Comptage** | n + r | n + r | n + r | n + r | Oui | r - le plus grand nombre dans la liste |
+| **Tri Radix** | n \* k | n \* k | n \* k | n + k | Non | k - longueur du plus long index |
diff --git a/README.ja-JP.md b/README.ja-JP.md
index 144ba508d1..3810200c71 100644
--- a/README.ja-JP.md
+++ b/README.ja-JP.md
@@ -1,13 +1,12 @@
-# JavaScriptアルゴリズムとデータ構造
+# JavaScript アルゴリズムとデータ構造
[](https://travis-ci.org/trekhleb/javascript-algorithms)
[](https://codecov.io/gh/trekhleb/javascript-algorithms)
-このリポジトリには、JavaScriptベースの一般的なアルゴリズムとデータ構造に関する多数のサンプルが含まれています。
+このリポジトリには、JavaScript ベースの一般的なアルゴリズムとデータ構造に関する多数のサンプルが含まれています。
-
-各アルゴリズムとデータ構造には独自のREADMEがあります。
-関連する説明と、さらに読むためのリンク (関連YouTubeのビデオ)も含まれています。
+各アルゴリズムとデータ構造には独自の README があります。
+関連する説明と、さらに読むためのリンク (関連 YouTube のビデオ)も含まれています。
_Read this in other languages:_
[_English_](https://github.com/trekhleb/javascript-algorithms/),
@@ -17,7 +16,8 @@ _Read this in other languages:_
[_Polski_](README.pl-PL.md),
[_Français_](README.fr-FR.md),
[_Español_](README.es-ES.md),
-[_Português_](README.pt-BR.md)
+[_Português_](README.pt-BR.md),
+[_Русский_](README.ru-RU.md)
## データ構造
@@ -28,23 +28,23 @@ _Read this in other languages:_
`B` - 初心者, `A` - 上級
-* `B` [リンクされたリスト](src/data-structures/linked-list)
-* `B` [二重リンクリスト](src/data-structures/doubly-linked-list)
-* `B` [キュー](src/data-structures/queue)
-* `B` [スタック](src/data-structures/stack)
-* `B` [ハッシュ表](src/data-structures/hash-table)
-* `B` [ヒープ](src/data-structures/heap) - max and min heap versions
-* `B` [優先度キュー](src/data-structures/priority-queue)
-* `A` [トライ](src/data-structures/trie)
-* `A` [ツリー](src/data-structures/tree)
- * `A` [バイナリ検索ツリー](src/data-structures/tree/binary-search-tree)
- * `A` [AVLツリー](src/data-structures/tree/avl-tree)
- * `A` [赤黒のツリー](src/data-structures/tree/red-black-tree)
- * `A` [セグメントツリー](src/data-structures/tree/segment-tree) - with min/max/sum range queries examples
- * `A` [フェンウィック・ツリー](src/data-structures/tree/fenwick-tree) (Binary Indexed Tree)
-* `A` [グラフ](src/data-structures/graph) (both directed and undirected)
-* `A` [分離集合](src/data-structures/disjoint-set)
-* `A` [ブルームフィルタ](src/data-structures/bloom-filter)
+- `B` [リンクされたリスト](src/data-structures/linked-list)
+- `B` [二重リンクリスト](src/data-structures/doubly-linked-list)
+- `B` [キュー](src/data-structures/queue)
+- `B` [スタック](src/data-structures/stack)
+- `B` [ハッシュ表](src/data-structures/hash-table)
+- `B` [ヒープ](src/data-structures/heap) - max and min heap versions
+- `B` [優先度キュー](src/data-structures/priority-queue)
+- `A` [トライ](src/data-structures/trie)
+- `A` [ツリー](src/data-structures/tree)
+ - `A` [バイナリ検索ツリー](src/data-structures/tree/binary-search-tree)
+ - `A` [AVL ツリー](src/data-structures/tree/avl-tree)
+ - `A` [赤黒のツリー](src/data-structures/tree/red-black-tree)
+ - `A` [セグメントツリー](src/data-structures/tree/segment-tree) - with min/max/sum range queries examples
+ - `A` [フェンウィック・ツリー](src/data-structures/tree/fenwick-tree) (Binary Indexed Tree)
+- `A` [グラフ](src/data-structures/graph) (both directed and undirected)
+- `A` [分離集合](src/data-structures/disjoint-set)
+- `A` [ブルームフィルタ](src/data-structures/bloom-filter)
## アルゴリズム
@@ -55,158 +55,160 @@ _Read this in other languages:_
### トピック別アルゴリズム
-* **数学**
- * `B` [ビット操作](src/algorithms/math/bits) - set/get/update/clear bits, 2つの乗算/除算, 否定的にする. 等
- * `B` [因果関係](src/algorithms/math/factorial)
- * `B` [フィボナッチ数](src/algorithms/math/fibonacci) - クラシックとクローズドフォームのバージョン
- * `B` [素数性テスト](src/algorithms/math/primality-test) (trial division 方法)
- * `B` [ユークリッドアルゴリズム](src/algorithms/math/euclidean-algorithm) - 最大公約数を計算する (GCD)
- * `B` [最小公倍数](src/algorithms/math/least-common-multiple) (LCM)
- * `B` [エラトステネスのふるい](src/algorithms/math/sieve-of-eratosthenes) - 与えられた限度まですべての素数を見つける
- * `B` [Is Power of Two](src/algorithms/math/is-power-of-two) - 数値が2の累乗であるかどうかを調べる(単純なアルゴリズムとビットごとのアルゴリズム)
- * `B` [パスカルの三角形](src/algorithms/math/pascal-triangle)
- * `B` [複素数](src/algorithms/math/complex-number) - 複素数とその基本演算
- * `B` [ラジアン&度](src/algorithms/math/radian) - 度数と逆方向の変換に対するラジアン
- * `B` [高速電力供給](src/algorithms/math/fast-powering)
- * `A` [整数パーティション](src/algorithms/math/integer-partition)
- * `A` [Liu Hui π アルゴリズム](src/algorithms/math/liu-hui) - N-gonsに基づく近似π計算
- * `A` [離散フーリエ変換](src/algorithms/math/fourier-transform) - 時間(信号)の関数をそれを構成する周波数に分解する
-* **セット**
- * `B` [デカルト積 ](src/algorithms/sets/cartesian-product) - 複数の積の積
- * `B` [Fisher–Yates Shuffle](src/algorithms/sets/fisher-yates) - 有限シーケンスのランダム置換
- * `A` [パワーセット](src/algorithms/sets/power-set) - セットのすべてのサブセット(ビットごとのソリューションとバックトラッキングソリューション)
- * `A` [順列](src/algorithms/sets/permutations) (繰り返しの有無にかかわらず)
- * `A` [組み合わせ](src/algorithms/sets/combinations) (繰返しあり、繰返しなし)
- * `A` [最長共通部分列](src/algorithms/sets/longest-common-subsequence) (LCS)
- * `A` [最長増加サブシーケンス](src/algorithms/sets/longest-increasing-subsequence)
- * `A` [最短共通スーパーシーケンス](src/algorithms/sets/shortest-common-supersequence) (SCS)
- * `A` [ナップザック問題 ](src/algorithms/sets/knapsack-problem) - 「0/1」と「非結合」問題
- * `A` [最大サブアレイ](src/algorithms/sets/maximum-subarray) - 「ブルートフォース」と「ダイナミックプログラミング」(Kadane's版)
- * `A` [組み合わせ合計](src/algorithms/sets/combination-sum) - 特定の合計を構成するすべての組み合わせを見つける
-* **文字列**
- * `B` [ハミング距離](src/algorithms/string/hamming-distance) - シンボルが異なる位置の数
- * `A` [レーベンシュタイン距離](src/algorithms/string/levenshtein-distance) - 2つのシーケンス間の最小編集距離
- * `A` [Knuth-Morris-Prattアルゴリズム](src/algorithms/string/knuth-morris-pratt) (KMP Algorithm) - 部分文字列検索 (pattern matching)
- * `A` [Z アルゴリズム](src/algorithms/string/z-algorithm) - 部分文字列検索 (pattern matching)
- * `A` [Rabin Karpアルゴリズム](src/algorithms/string/rabin-karp) - 部分文字列検索
- * `A` [最長共通部分文字列](src/algorithms/string/longest-common-substring)
- * `A` [正規表現マッチング](src/algorithms/string/regular-expression-matching)
-* **検索**
- * `B` [リニアサーチ](src/algorithms/search/linear-search)
- * `B` [ジャンプ検索](src/algorithms/search/jump-search) (or Block Search) - ソートされた配列で検索
- * `B` [バイナリ検索](src/algorithms/search/binary-search) - ソートされた配列で検索
- * `B` [補間探索](src/algorithms/search/interpolation-search) - 一様分布のソート配列で検索する
-* **並べ替え**
- * `B` [バブルソート](src/algorithms/sorting/bubble-sort)
- * `B` [選択ソート](src/algorithms/sorting/selection-sort)
- * `B` [挿入ソート](src/algorithms/sorting/insertion-sort)
- * `B` [ヒープソート](src/algorithms/sorting/heap-sort)
- * `B` [マージソート](src/algorithms/sorting/merge-sort)
- * `B` [クイックソート](src/algorithms/sorting/quick-sort) -インプレースおよび非インプレース・インプリメンテーション
- * `B` [シェルソート](src/algorithms/sorting/shell-sort)
- * `B` [並べ替えを数える](src/algorithms/sorting/counting-sort)
- * `B` [基数ソート](src/algorithms/sorting/radix-sort)
-* **リンクされたリスト**
- * `B` [ストレートトラバーサル](src/algorithms/linked-list/traversal)
- * `B` [逆方向のトラバーサル](src/algorithms/linked-list/reverse-traversal)
-* **ツリー**
- * `B` [深度優先検索](src/algorithms/tree/depth-first-search) (DFS)
- * `B` [幅優先検索](src/algorithms/tree/breadth-first-search) (BFS)
-* **グラフ**
- * `B` [深度優先検索](src/algorithms/graph/depth-first-search) (DFS)
- * `B` [幅優先検索](src/algorithms/graph/breadth-first-search) (BFS)
- * `B` [Kruskalのアルゴリズム](src/algorithms/graph/kruskal) - 重み付き無向グラフの最小スパニングツリー(MST)の発見
- * `A` [Dijkstraアルゴリズム](src/algorithms/graph/dijkstra) - 単一の頂点からすべてのグラフ頂点への最短経路を見つける
- * `A` [Bellman-Fordアルゴリズム](src/algorithms/graph/bellman-ford) - 単一の頂点からすべてのグラフ頂点への最短経路を見つける
- * `A` [Floyd-Warshallアルゴリズム](src/algorithms/graph/floyd-warshall) - すべての頂点ペア間の最短経路を見つける
- * `A` [Detect Cycle](src/algorithms/graph/detect-cycle) - 有向グラフと無向グラフの両方(DFSおよびディスジョイントセットベースのバージョン)
- * `A` [プリムのアルゴリズム](src/algorithms/graph/prim) - 重み付き無向グラフの最小スパニングツリー(MST)の発見
- * `A` [トポロジカルソート](src/algorithms/graph/topological-sorting) - DFSメソッド
- * `A` [アーティキュレーションポイント](src/algorithms/graph/articulation-points) - Tarjanのアルゴリズム(DFSベース)
- * `A` [ブリッジ ](src/algorithms/graph/bridges) - DFSベースのアルゴリズム
- * `A` [オイラーパスとオイラー回路](src/algorithms/graph/eulerian-path) - フルリーアルゴリズム - すべてのエッジを正確に1回訪問する
- * `A` [ハミルトニアンサイクル](src/algorithms/graph/hamiltonian-cycle) - すべての頂点を正確に1回訪問する
- * `A` [強連結成分](src/algorithms/graph/strongly-connected-components) - コサラジュのアルゴリズム
- * `A` [トラベリングセールスマン問題](src/algorithms/graph/travelling-salesman) - 各都市を訪問し、起点都市に戻る最短経路
-* **暗号**
- * `B` [多項式ハッシュ](src/algorithms/cryptography/polynomial-hash) - 関数多項式に基づくハッシュ関数
-* **未分類**
- * `B` [ハノイの塔](src/algorithms/uncategorized/hanoi-tower)
- * `B` [正方行列回転](src/algorithms/uncategorized/square-matrix-rotation) - インプレイスアルゴリズム
- * `B` [ジャンプゲーム](src/algorithms/uncategorized/jump-game) - バックトラック、ダイナミックプログラミング(トップダウン+ボトムアップ)、欲張りの例
- * `B` [ユニークなパス](src/algorithms/uncategorized/unique-paths) - バックトラック、動的プログラミング、PascalのTriangleベースの例
- * `B` [レインテラス](src/algorithms/uncategorized/rain-terraces) - トラップ雨水問題(ダイナミックプログラミングとブルートフォースバージョン)
- * `B` [再帰的階段](src/algorithms/uncategorized/recursive-staircase) - 上に到達する方法の数を数える(4つのソリューション)
- * `A` [N-クイーンズ問題](src/algorithms/uncategorized/n-queens)
- * `A` [ナイトツアー](src/algorithms/uncategorized/knight-tour)
-
-### Paradigmによるアルゴリズム
+- **数学**
+ - `B` [ビット操作](src/algorithms/math/bits) - set/get/update/clear bits, 2 つの乗算/除算, 否定的にする. 等
+ - `B` [因果関係](src/algorithms/math/factorial)
+ - `B` [フィボナッチ数](src/algorithms/math/fibonacci) - クラシックとクローズドフォームのバージョン
+ - `B` [素数性テスト](src/algorithms/math/primality-test) (trial division 方法)
+ - `B` [ユークリッドアルゴリズム](src/algorithms/math/euclidean-algorithm) - 最大公約数を計算する (GCD)
+ - `B` [最小公倍数](src/algorithms/math/least-common-multiple) (LCM)
+ - `B` [エラトステネスのふるい](src/algorithms/math/sieve-of-eratosthenes) - 与えられた限度まですべての素数を見つける
+ - `B` [Is Power of Two](src/algorithms/math/is-power-of-two) - 数値が 2 の累乗であるかどうかを調べる(単純なアルゴリズムとビットごとのアルゴリズム)
+ - `B` [パスカルの三角形](src/algorithms/math/pascal-triangle)
+ - `B` [複素数](src/algorithms/math/complex-number) - 複素数とその基本演算
+ - `B` [ラジアン&度](src/algorithms/math/radian) - 度数と逆方向の変換に対するラジアン
+ - `B` [高速電力供給](src/algorithms/math/fast-powering)
+ - `A` [整数パーティション](src/algorithms/math/integer-partition)
+ - `A` [Liu Hui π アルゴリズム](src/algorithms/math/liu-hui) - N-gons に基づく近似 π 計算
+ - `A` [離散フーリエ変換](src/algorithms/math/fourier-transform) - 時間(信号)の関数をそれを構成する周波数に分解する
+- **セット**
+ - `B` [デカルト積 ](src/algorithms/sets/cartesian-product) - 複数の積の積
+ - `B` [Fisher–Yates Shuffle](src/algorithms/sets/fisher-yates) - 有限シーケンスのランダム置換
+ - `A` [パワーセット](src/algorithms/sets/power-set) - セットのすべてのサブセット(ビットごとのソリューションとバックトラッキングソリューション)
+ - `A` [順列](src/algorithms/sets/permutations) (繰り返しの有無にかかわらず)
+ - `A` [組み合わせ](src/algorithms/sets/combinations) (繰返しあり、繰返しなし)
+ - `A` [最長共通部分列](src/algorithms/sets/longest-common-subsequence) (LCS)
+ - `A` [最長増加サブシーケンス](src/algorithms/sets/longest-increasing-subsequence)
+ - `A` [最短共通スーパーシーケンス](src/algorithms/sets/shortest-common-supersequence) (SCS)
+ - `A` [ナップザック問題 ](src/algorithms/sets/knapsack-problem) - 「0/1」と「非結合」問題
+ - `A` [最大サブアレイ](src/algorithms/sets/maximum-subarray) - 「ブルートフォース」と「ダイナミックプログラミング」(Kadane's 版)
+ - `A` [組み合わせ合計](src/algorithms/sets/combination-sum) - 特定の合計を構成するすべての組み合わせを見つける
+- **文字列**
+ - `B` [ハミング距離](src/algorithms/string/hamming-distance) - シンボルが異なる位置の数
+ - `A` [レーベンシュタイン距離](src/algorithms/string/levenshtein-distance) - 2 つのシーケンス間の最小編集距離
+ - `A` [Knuth-Morris-Pratt アルゴリズム](src/algorithms/string/knuth-morris-pratt) (KMP Algorithm) - 部分文字列検索 (pattern matching)
+ - `A` [Z アルゴリズム](src/algorithms/string/z-algorithm) - 部分文字列検索 (pattern matching)
+ - `A` [Rabin Karp アルゴリズム](src/algorithms/string/rabin-karp) - 部分文字列検索
+ - `A` [最長共通部分文字列](src/algorithms/string/longest-common-substring)
+ - `A` [正規表現マッチング](src/algorithms/string/regular-expression-matching)
+- **検索**
+ - `B` [リニアサーチ](src/algorithms/search/linear-search)
+ - `B` [ジャンプ検索](src/algorithms/search/jump-search) (or Block Search) - ソートされた配列で検索
+ - `B` [バイナリ検索](src/algorithms/search/binary-search) - ソートされた配列で検索
+ - `B` [補間探索](src/algorithms/search/interpolation-search) - 一様分布のソート配列で検索する
+- **並べ替え**
+ - `B` [バブルソート](src/algorithms/sorting/bubble-sort)
+ - `B` [選択ソート](src/algorithms/sorting/selection-sort)
+ - `B` [挿入ソート](src/algorithms/sorting/insertion-sort)
+ - `B` [ヒープソート](src/algorithms/sorting/heap-sort)
+ - `B` [マージソート](src/algorithms/sorting/merge-sort)
+ - `B` [クイックソート](src/algorithms/sorting/quick-sort) -インプレースおよび非インプレース・インプリメンテーション
+ - `B` [シェルソート](src/algorithms/sorting/shell-sort)
+ - `B` [並べ替えを数える](src/algorithms/sorting/counting-sort)
+ - `B` [基数ソート](src/algorithms/sorting/radix-sort)
+- **リンクされたリスト**
+ - `B` [ストレートトラバーサル](src/algorithms/linked-list/traversal)
+ - `B` [逆方向のトラバーサル](src/algorithms/linked-list/reverse-traversal)
+- **ツリー**
+ - `B` [深度優先検索](src/algorithms/tree/depth-first-search) (DFS)
+ - `B` [幅優先検索](src/algorithms/tree/breadth-first-search) (BFS)
+- **グラフ**
+ - `B` [深度優先検索](src/algorithms/graph/depth-first-search) (DFS)
+ - `B` [幅優先検索](src/algorithms/graph/breadth-first-search) (BFS)
+ - `B` [Kruskal のアルゴリズム](src/algorithms/graph/kruskal) - 重み付き無向グラフの最小スパニングツリー(MST)の発見
+ - `A` [Dijkstra アルゴリズム](src/algorithms/graph/dijkstra) - 単一の頂点からすべてのグラフ頂点への最短経路を見つける
+ - `A` [Bellman-Ford アルゴリズム](src/algorithms/graph/bellman-ford) - 単一の頂点からすべてのグラフ頂点への最短経路を見つける
+ - `A` [Floyd-Warshall アルゴリズム](src/algorithms/graph/floyd-warshall) - すべての頂点ペア間の最短経路を見つける
+ - `A` [Detect Cycle](src/algorithms/graph/detect-cycle) - 有向グラフと無向グラフの両方(DFS およびディスジョイントセットベースのバージョン)
+ - `A` [プリムのアルゴリズム](src/algorithms/graph/prim) - 重み付き無向グラフの最小スパニングツリー(MST)の発見
+ - `A` [トポロジカルソート](src/algorithms/graph/topological-sorting) - DFS メソッド
+ - `A` [アーティキュレーションポイント](src/algorithms/graph/articulation-points) - Tarjan のアルゴリズム(DFS ベース)
+ - `A` [ブリッジ ](src/algorithms/graph/bridges) - DFS ベースのアルゴリズム
+ - `A` [オイラーパスとオイラー回路](src/algorithms/graph/eulerian-path) - フルリーアルゴリズム - すべてのエッジを正確に 1 回訪問する
+ - `A` [ハミルトニアンサイクル](src/algorithms/graph/hamiltonian-cycle) - すべての頂点を正確に 1 回訪問する
+ - `A` [強連結成分](src/algorithms/graph/strongly-connected-components) - コサラジュのアルゴリズム
+ - `A` [トラベリングセールスマン問題](src/algorithms/graph/travelling-salesman) - 各都市を訪問し、起点都市に戻る最短経路
+- **暗号**
+ - `B` [多項式ハッシュ](src/algorithms/cryptography/polynomial-hash) - 関数多項式に基づくハッシュ関数
+- **未分類**
+ - `B` [ハノイの塔](src/algorithms/uncategorized/hanoi-tower)
+ - `B` [正方行列回転](src/algorithms/uncategorized/square-matrix-rotation) - インプレイスアルゴリズム
+ - `B` [ジャンプゲーム](src/algorithms/uncategorized/jump-game) - バックトラック、ダイナミックプログラミング(トップダウン+ボトムアップ)、欲張りの例
+ - `B` [ユニークなパス](src/algorithms/uncategorized/unique-paths) - バックトラック、動的プログラミング、Pascal の Triangle ベースの例
+ - `B` [レインテラス](src/algorithms/uncategorized/rain-terraces) - トラップ雨水問題(ダイナミックプログラミングとブルートフォースバージョン)
+ - `B` [再帰的階段](src/algorithms/uncategorized/recursive-staircase) - 上に到達する方法の数を数える(4 つのソリューション)
+ - `A` [N-クイーンズ問題](src/algorithms/uncategorized/n-queens)
+ - `A` [ナイトツアー](src/algorithms/uncategorized/knight-tour)
+
+### Paradigm によるアルゴリズム
アルゴリズムパラダイムは、あるクラスのアルゴリズムの設計の基礎をなす一般的な方法またはアプローチである。それは、アルゴリズムがコンピュータプログラムよりも高い抽象であるのと同様に、アルゴリズムの概念よりも高い抽象である。
-* **ブルートフォース** - べての可能性を見て最適なソリューションを選択する
- * `B` [線形探索](src/algorithms/search/linear-search)
- * `B` [レインテラス](src/algorithms/uncategorized/rain-terraces) - 雨水問題
- * `B` [Recursive Staircase](src/algorithms/uncategorized/recursive-staircase) - 先頭に到達する方法の数を数えます
- * `A` [最大サブアレイ](src/algorithms/sets/maximum-subarray)
- * `A` [旅行セールスマン問題](src/algorithms/graph/travelling-salesman) - 各都市を訪れ、起点都市に戻る最短ルート
- * `A` [離散フーリエ変換](src/algorithms/math/fourier-transform) - 時間(信号)の関数をそれを構成する周波数に分解する
-* **欲張り** - 未来を考慮することなく、現時点で最適なオプションを選択する
- * `B` [ジャンプゲーム](src/algorithms/uncategorized/jump-game)
- * `A` [結合されていないナップザック問題](src/algorithms/sets/knapsack-problem)
- * `A` [Dijkstra Algorithm](src/algorithms/graph/dijkstra) - すべてのグラフ頂点への最短経路を見つける
- * `A` [Prim’s Algorithm](src/algorithms/graph/prim) - 重み付き無向グラフの最小スパニングツリー(MST)を見つける
- * `A` [Kruskalのアルゴリズム](src/algorithms/graph/kruskal) - 重み付き無向グラフの最小スパニングツリー(MST)を見つける
-* **分割と征服** - 問題をより小さな部分に分割し、それらの部分を解決する
- * `B` [バイナリ検索](src/algorithms/search/binary-search)
- * `B` [ハノイの塔](src/algorithms/uncategorized/hanoi-tower)
- * `B` [パスカルの三角形](src/algorithms/math/pascal-triangle)
- * `B` [ユークリッドアルゴリズム](src/algorithms/math/euclidean-algorithm) - GCD(Greatest Common Divisor)を計算する
- * `B` [マージソート](src/algorithms/sorting/merge-sort)
- * `B` [クイックソート](src/algorithms/sorting/quick-sort)
- * `B` [ツリーの深さ優先検索](src/algorithms/tree/depth-first-search) (DFS)
- * `B` [グラフの深さ優先検索](src/algorithms/graph/depth-first-search) (DFS)
- * `B` [ジャンプゲーム](src/algorithms/uncategorized/jump-game)
- * `B` [高速電力供給](src/algorithms/math/fast-powering)
- * `A` [順列](src/algorithms/sets/permutations) (繰り返しの有無にかかわらず)
- * `A` [組み合わせ](src/algorithms/sets/combinations)(繰返しあり、繰返しなし)
-* **動的プログラミング** - 以前に発見されたサブソリューションを使用してソリューションを構築する
- * `B` [フィボナッチ数](src/algorithms/math/fibonacci)
- * `B` [ジャンプゲーム](src/algorithms/uncategorized/jump-game)
- * `B` [ユニークなパス](src/algorithms/uncategorized/unique-paths)
- * `B` [雨テラス](src/algorithms/uncategorized/rain-terraces) - トラップ雨水問題
- * `B` [再帰的階段](src/algorithms/uncategorized/recursive-staircase) - 上に到達する方法の数を数える
- * `A` [Levenshtein Distance](src/algorithms/string/levenshtein-distance) - 2つのシーケンス間の最小編集距離
- * `A` [最長共通部分列](src/algorithms/sets/longest-common-subsequence) (LCS)
- * `A` [最長共通部分文字列](src/algorithms/string/longest-common-substring)
- * `A` [最長増加サブシーケンス](src/algorithms/sets/longest-increasing-subsequence)
- * `A` [最短共通共通配列](src/algorithms/sets/shortest-common-supersequence)
- * `A` [0/1ナップザック問題](src/algorithms/sets/knapsack-problem)
- * `A` [整数パーティション](src/algorithms/math/integer-partition)
- * `A` [最大サブアレイ](src/algorithms/sets/maximum-subarray)
- * `A` [Bellman-Fordアルゴリズム](src/algorithms/graph/bellman-ford) - すべてのグラフ頂点への最短経路を見つける
- * `A` [Floyd-Warshallアルゴリズム](src/algorithms/graph/floyd-warshall) - すべての頂点ペア間の最短経路を見つける
- * `A` [正規表現マッチング](src/algorithms/string/regular-expression-matching)
-* **バックトラッキング** - ブルートフォースと同様に、可能なすべてのソリューションを生成しようとしますが、
+
+- **ブルートフォース** - べての可能性を見て最適なソリューションを選択する
+ - `B` [線形探索](src/algorithms/search/linear-search)
+ - `B` [レインテラス](src/algorithms/uncategorized/rain-terraces) - 雨水問題
+ - `B` [Recursive Staircase](src/algorithms/uncategorized/recursive-staircase) - 先頭に到達する方法の数を数えます
+ - `A` [最大サブアレイ](src/algorithms/sets/maximum-subarray)
+ - `A` [旅行セールスマン問題](src/algorithms/graph/travelling-salesman) - 各都市を訪れ、起点都市に戻る最短ルート
+ - `A` [離散フーリエ変換](src/algorithms/math/fourier-transform) - 時間(信号)の関数をそれを構成する周波数に分解する
+- **欲張り** - 未来を考慮することなく、現時点で最適なオプションを選択する
+ - `B` [ジャンプゲーム](src/algorithms/uncategorized/jump-game)
+ - `A` [結合されていないナップザック問題](src/algorithms/sets/knapsack-problem)
+ - `A` [Dijkstra Algorithm](src/algorithms/graph/dijkstra) - すべてのグラフ頂点への最短経路を見つける
+ - `A` [Prim’s Algorithm](src/algorithms/graph/prim) - 重み付き無向グラフの最小スパニングツリー(MST)を見つける
+ - `A` [Kruskal のアルゴリズム](src/algorithms/graph/kruskal) - 重み付き無向グラフの最小スパニングツリー(MST)を見つける
+- **分割と征服** - 問題をより小さな部分に分割し、それらの部分を解決する
+ - `B` [バイナリ検索](src/algorithms/search/binary-search)
+ - `B` [ハノイの塔](src/algorithms/uncategorized/hanoi-tower)
+ - `B` [パスカルの三角形](src/algorithms/math/pascal-triangle)
+ - `B` [ユークリッドアルゴリズム](src/algorithms/math/euclidean-algorithm) - GCD(Greatest Common Divisor)を計算する
+ - `B` [マージソート](src/algorithms/sorting/merge-sort)
+ - `B` [クイックソート](src/algorithms/sorting/quick-sort)
+ - `B` [ツリーの深さ優先検索](src/algorithms/tree/depth-first-search) (DFS)
+ - `B` [グラフの深さ優先検索](src/algorithms/graph/depth-first-search) (DFS)
+ - `B` [ジャンプゲーム](src/algorithms/uncategorized/jump-game)
+ - `B` [高速電力供給](src/algorithms/math/fast-powering)
+ - `A` [順列](src/algorithms/sets/permutations) (繰り返しの有無にかかわらず)
+ - `A` [組み合わせ](src/algorithms/sets/combinations)(繰返しあり、繰返しなし)
+- **動的プログラミング** - 以前に発見されたサブソリューションを使用してソリューションを構築する
+ - `B` [フィボナッチ数](src/algorithms/math/fibonacci)
+ - `B` [ジャンプゲーム](src/algorithms/uncategorized/jump-game)
+ - `B` [ユニークなパス](src/algorithms/uncategorized/unique-paths)
+ - `B` [雨テラス](src/algorithms/uncategorized/rain-terraces) - トラップ雨水問題
+ - `B` [再帰的階段](src/algorithms/uncategorized/recursive-staircase) - 上に到達する方法の数を数える
+ - `A` [Levenshtein Distance](src/algorithms/string/levenshtein-distance) - 2 つのシーケンス間の最小編集距離
+ - `A` [最長共通部分列](src/algorithms/sets/longest-common-subsequence) (LCS)
+ - `A` [最長共通部分文字列](src/algorithms/string/longest-common-substring)
+ - `A` [最長増加サブシーケンス](src/algorithms/sets/longest-increasing-subsequence)
+ - `A` [最短共通共通配列](src/algorithms/sets/shortest-common-supersequence)
+ - `A` [0/1 ナップザック問題](src/algorithms/sets/knapsack-problem)
+ - `A` [整数パーティション](src/algorithms/math/integer-partition)
+ - `A` [最大サブアレイ](src/algorithms/sets/maximum-subarray)
+ - `A` [Bellman-Ford アルゴリズム](src/algorithms/graph/bellman-ford) - すべてのグラフ頂点への最短経路を見つける
+ - `A` [Floyd-Warshall アルゴリズム](src/algorithms/graph/floyd-warshall) - すべての頂点ペア間の最短経路を見つける
+ - `A` [正規表現マッチング](src/algorithms/string/regular-expression-matching)
+- **バックトラッキング** - ブルートフォースと同様に、可能なすべてのソリューションを生成しようとしますが、
次のソリューションを生成するたびにすべての条件を満たすかどうかをテストし、それ以降は引き続きソリューションを生成します。
それ以外の場合は、バックトラックして、解決策を見つける別の経路に進みます。
- 通常、状態空間のDFSトラバーサルが使用されています。
- * `B` [ジャンプゲーム](src/algorithms/uncategorized/jump-game)
- * `B` [ユニークなパス](src/algorithms/uncategorized/unique-paths)
- * `B` [パワーセット](src/algorithms/sets/power-set) - セットのすべてのサブセット
- * `A` [ハミルトニアンサイクル](src/algorithms/graph/hamiltonian-cycle) - すべての頂点を正確に1回訪問する
- * `A` [N-クイーンズ問題](src/algorithms/uncategorized/n-queens)
- * `A` [ナイトツアー](src/algorithms/uncategorized/knight-tour)
- * `A` [組み合わせ合計](src/algorithms/sets/combination-sum) - 特定の合計を構成するすべての組み合わせを見つける
-* **ブランチ&バウンド** - バックトラック検索の各段階で見つかった最もコストの低いソリューションを覚えておいて、最もコストの低いソリューションのコストを使用します。これまでに発見された最もコストの低いソリューションよりも大きなコストで部分ソリューションを破棄するように指示します。通常、状態空間ツリーのDFSトラバーサルと組み合わせたBFSトラバーサルが使用されています。
+ 通常、状態空間の DFS トラバーサルが使用されています。
+ - `B` [ジャンプゲーム](src/algorithms/uncategorized/jump-game)
+ - `B` [ユニークなパス](src/algorithms/uncategorized/unique-paths)
+ - `B` [パワーセット](src/algorithms/sets/power-set) - セットのすべてのサブセット
+ - `A` [ハミルトニアンサイクル](src/algorithms/graph/hamiltonian-cycle) - すべての頂点を正確に 1 回訪問する
+ - `A` [N-クイーンズ問題](src/algorithms/uncategorized/n-queens)
+ - `A` [ナイトツアー](src/algorithms/uncategorized/knight-tour)
+ - `A` [組み合わせ合計](src/algorithms/sets/combination-sum) - 特定の合計を構成するすべての組み合わせを見つける
+- **ブランチ&バウンド** - バックトラック検索の各段階で見つかった最もコストの低いソリューションを覚えておいて、最もコストの低いソリューションのコストを使用します。これまでに発見された最もコストの低いソリューションよりも大きなコストで部分ソリューションを破棄するように指示します。通常、状態空間ツリーの DFS トラバーサルと組み合わせた BFS トラバーサルが使用されています。
## このリポジトリの使い方
**すべての依存関係をインストールする**
+
```
npm install
```
-**ESLintを実行する**
+**ESLint を実行する**
これを実行してコードの品質をチェックすることができます。
@@ -215,11 +217,13 @@ npm run lint
```
**すべてのテストを実行する**
+
```
npm test
```
**名前でテストを実行する**
+
```
npm test -- 'LinkedList'
```
@@ -241,51 +245,51 @@ npm test -- 'playground'
[▶ データ構造とアルゴリズム on YouTube](https://www.youtube.com/playlist?list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8)
-### ビッグO表記
+### ビッグ O 表記
-*Big O表記法は* 入力サイズが大きくなるにつれて実行時間やスペース要件がどのように増加するかに応じてアルゴリズムを分類するために使用されます。下のチャートでは、Big O表記で指定されたアルゴリズムの成長の最も一般的な順序を見つけることができます。
+_Big O 表記法は_ 入力サイズが大きくなるにつれて実行時間やスペース要件がどのように増加するかに応じてアルゴリズムを分類するために使用されます。下のチャートでは、Big O 表記で指定されたアルゴリズムの成長の最も一般的な順序を見つけることができます。

-出典: [Big Oチートシート](http://bigocheatsheet.com/).
+出典: [Big O チートシート](http://bigocheatsheet.com/).
-以下は、最も使用されているBig O表記のリストと、入力データのさまざまなサイズに対するパフォーマンス比較です。
+以下は、最も使用されている Big O 表記のリストと、入力データのさまざまなサイズに対するパフォーマンス比較です。
-| Big O Notation | Computations for 10 elements | Computations for 100 elements | Computations for 1000 elements |
-| -------------- | ---------------------------- | ----------------------------- | ------------------------------- |
-| **O(1)** | 1 | 1 | 1 |
-| **O(log N)** | 3 | 6 | 9 |
-| **O(N)** | 10 | 100 | 1000 |
-| **O(N log N)** | 30 | 600 | 9000 |
-| **O(N^2)** | 100 | 10000 | 1000000 |
-| **O(2^N)** | 1024 | 1.26e+29 | 1.07e+301 |
-| **O(N!)** | 3628800 | 9.3e+157 | 4.02e+2567 |
+| Big O Notation | Computations for 10 elements | Computations for 100 elements | Computations for 1000 elements |
+| -------------- | ---------------------------- | ----------------------------- | ------------------------------ |
+| **O(1)** | 1 | 1 | 1 |
+| **O(log N)** | 3 | 6 | 9 |
+| **O(N)** | 10 | 100 | 1000 |
+| **O(N log N)** | 30 | 600 | 9000 |
+| **O(N^2)** | 100 | 10000 | 1000000 |
+| **O(2^N)** | 1024 | 1.26e+29 | 1.07e+301 |
+| **O(N!)** | 3628800 | 9.3e+157 | 4.02e+2567 |
### データ構造操作の複雑さ
-| Data Structure | Access | Search | Insertion | Deletion | Comments |
-| ----------------------- | :-------: | :-------: | :-------: | :-------: | :-------- |
-| **Array** | 1 | n | n | n | |
-| **Stack** | n | n | 1 | 1 | |
-| **Queue** | n | n | 1 | 1 | |
-| **Linked List** | n | n | 1 | 1 | |
-| **Hash Table** | - | n | n | n | In case of perfect hash function costs would be O(1) |
-| **Binary Search Tree** | n | n | n | n | In case of balanced tree costs would be O(log(n)) |
-| **B-Tree** | log(n) | log(n) | log(n) | log(n) | |
-| **Red-Black Tree** | log(n) | log(n) | log(n) | log(n) | |
-| **AVL Tree** | log(n) | log(n) | log(n) | log(n) | |
-| **Bloom Filter** | - | 1 | 1 | - | False positives are possible while searching |
+| Data Structure | Access | Search | Insertion | Deletion | Comments |
+| ---------------------- | :----: | :----: | :-------: | :------: | :--------------------------------------------------- |
+| **Array** | 1 | n | n | n | |
+| **Stack** | n | n | 1 | 1 | |
+| **Queue** | n | n | 1 | 1 | |
+| **Linked List** | n | n | 1 | 1 | |
+| **Hash Table** | - | n | n | n | In case of perfect hash function costs would be O(1) |
+| **Binary Search Tree** | n | n | n | n | In case of balanced tree costs would be O(log(n)) |
+| **B-Tree** | log(n) | log(n) | log(n) | log(n) | |
+| **Red-Black Tree** | log(n) | log(n) | log(n) | log(n) | |
+| **AVL Tree** | log(n) | log(n) | log(n) | log(n) | |
+| **Bloom Filter** | - | 1 | 1 | - | False positives are possible while searching |
### 配列の並べ替えアルゴリズムの複雑さ
-| Name | Best | Average | Worst | Memory | Stable | Comments |
-| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- |
-| **Bubble sort** | n | n2 | n2 | 1 | Yes | |
-| **Insertion sort** | n | n2 | n2 | 1 | Yes | |
-| **Selection sort** | n2 | n2 | n2 | 1 | No | |
-| **Heap sort** | n log(n) | n log(n) | n log(n) | 1 | No | |
-| **Merge sort** | n log(n) | n log(n) | n log(n) | n | Yes | |
-| **Quick sort** | n log(n) | n log(n) | n2 | log(n) | No | Quicksort is usually done in-place with O(log(n)) stack space |
-| **Shell sort** | n log(n) | depends on gap sequence | n (log(n))2 | 1 | No | |
-| **Counting sort** | n + r | n + r | n + r | n + r | Yes | r - biggest number in array |
-| **Radix sort** | n * k | n * k | n * k | n + k | Yes | k - length of longest key |
+| Name | Best | Average | Worst | Memory | Stable | Comments |
+| ------------------ | :-----------: | :---------------------: | :-------------------------: | :----: | :----: | :------------------------------------------------------------ |
+| **Bubble sort** | n | n2 | n2 | 1 | Yes | |
+| **Insertion sort** | n | n2 | n2 | 1 | Yes | |
+| **Selection sort** | n2 | n2 | n2 | 1 | No | |
+| **Heap sort** | n log(n) | n log(n) | n log(n) | 1 | No | |
+| **Merge sort** | n log(n) | n log(n) | n log(n) | n | Yes | |
+| **Quick sort** | n log(n) | n log(n) | n2 | log(n) | No | Quicksort is usually done in-place with O(log(n)) stack space |
+| **Shell sort** | n log(n) | depends on gap sequence | n (log(n))2 | 1 | No | |
+| **Counting sort** | n + r | n + r | n + r | n + r | Yes | r - biggest number in array |
+| **Radix sort** | n \* k | n \* k | n \* k | n + k | Yes | k - length of longest key |
diff --git a/README.ko-KR.md b/README.ko-KR.md
index a42c8fe81c..7353d2f589 100644
--- a/README.ko-KR.md
+++ b/README.ko-KR.md
@@ -16,174 +16,175 @@ _Read this in other languages:_
[_Polski_](README.pl-PL.md),
[_Français_](README.fr-FR.md),
[_Español_](README.es-ES.md),
-[_Português_](README.pt-BR.md)
+[_Português_](README.pt-BR.md),
+[_Русский_](README.ru-RU.md)
## 자료 구조
자료 구조는 데이터를 특정 방식으로 구성하고 저장함으로써 더 효율적으로
접근하고 수정할 수 있게 해줍니다. 간단히 말해, 자료 구조는 데이터 값들,
-데이터 간의 관계, 그리고 데이터를 다룰 수 있는 함수와 작업의 모임입니다.
-
+데이터 간의 관계, 그리고 데이터를 다룰 수 있는 함수와 작업의 모임입니다.
`B` - 입문자, `A` - 숙련자
-* `B` [연결 리스트](src/data-structures/linked-list)
-* `B` [이중 연결 리스트](src/data-structures/doubly-linked-list)
-* `B` [큐](src/data-structures/queue)
-* `B` [스택](src/data-structures/stack)
-* `B` [해시 테이블](src/data-structures/hash-table)
-* `B` [힙](src/data-structures/heap)
-* `B` [우선순위 큐](src/data-structures/priority-queue)
-* `A` [트라이](src/data-structures/trie)
-* `A` [트리](src/data-structures/tree)
- * `A` [이진 탐색 트리](src/data-structures/tree/binary-search-tree)
- * `A` [AVL 트리](src/data-structures/tree/avl-tree)
- * `A` [Red-Black 트리](src/data-structures/tree/red-black-tree)
- * `A` [세그먼트 트리](src/data-structures/tree/segment-tree) - min/max/sum range 쿼리 예제.
- * `A` [Fenwick 트리](src/data-structures/tree/fenwick-tree) (Binary Indexed Tree)
-* `A` [그래프](src/data-structures/graph) (유방향, 무방향)
-* `A` [서로소 집합](src/data-structures/disjoint-set)
-* `A` [블룸 필터](src/data-structures/bloom-filter)
+- `B` [연결 리스트](src/data-structures/linked-list)
+- `B` [이중 연결 리스트](src/data-structures/doubly-linked-list)
+- `B` [큐](src/data-structures/queue)
+- `B` [스택](src/data-structures/stack)
+- `B` [해시 테이블](src/data-structures/hash-table)
+- `B` [힙](src/data-structures/heap)
+- `B` [우선순위 큐](src/data-structures/priority-queue)
+- `A` [트라이](src/data-structures/trie)
+- `A` [트리](src/data-structures/tree)
+ - `A` [이진 탐색 트리](src/data-structures/tree/binary-search-tree)
+ - `A` [AVL 트리](src/data-structures/tree/avl-tree)
+ - `A` [Red-Black 트리](src/data-structures/tree/red-black-tree)
+ - `A` [세그먼트 트리](src/data-structures/tree/segment-tree) - min/max/sum range 쿼리 예제.
+ - `A` [Fenwick 트리](src/data-structures/tree/fenwick-tree) (Binary Indexed Tree)
+- `A` [그래프](src/data-structures/graph) (유방향, 무방향)
+- `A` [서로소 집합](src/data-structures/disjoint-set)
+- `A` [블룸 필터](src/data-structures/bloom-filter)
## 알고리즘
-알고리즘은 어떤 종류의 문제를 풀 수 있는 정확한 방법이며,
-일련의 작업을 정확하게 정의해 놓은 규칙들입니다.
+알고리즘은 어떤 종류의 문제를 풀 수 있는 정확한 방법이며,
+일련의 작업을 정확하게 정의해 놓은 규칙들입니다.
`B` - 입문자, `A` - 숙련자
### 주제별 알고리즘
-* **Math**
- * `B` [Bit Manipulation](src/algorithms/math/bits) - set/get/update/clear bits, 2의 곱 / 나누기, 음수로 만들기 etc.
- * `B` [팩토리얼](src/algorithms/math/factorial)
- * `B` [피보나치 수](src/algorithms/math/fibonacci)
- * `B` [소수 판별](src/algorithms/math/primality-test) (trial division 방식)
- * `B` [유클리드 호제법](src/algorithms/math/euclidean-algorithm) - 최대공약수 (GCD)
- * `B` [최소 공배수](src/algorithms/math/least-common-multiple) - LCM
- * `B` [에라토스테네스의 체](src/algorithms/math/sieve-of-eratosthenes) - 특정수 이하의 모든 소수 찾기
- * `B` [2의 거듭제곱 판별법](src/algorithms/math/is-power-of-two) - 어떤 수가 2의 거듭제곱인지 판별 (naive 와 bitwise 알고리즘)
- * `B` [파스칼 삼각형](src/algorithms/math/pascal-triangle)
- * `A` [자연수 분할](src/algorithms/math/integer-partition)
- * `A` [리우 후이 π 알고리즘](src/algorithms/math/liu-hui) - N-각형을 기반으로 π 근사치 구하기
-* **Sets**
- * `B` [카티지언 프로덕트](src/algorithms/sets/cartesian-product) - 곱집합
- * `B` [Fisher–Yates 셔플](src/algorithms/sets/fisher-yates) - 유한 시퀀스의 무작위 순열
- * `A` [멱집합](src/algorithms/sets/power-set) - 집합의 모든 부분집합
- * `A` [순열](src/algorithms/sets/permutations) (반복 유,무)
- * `A` [조합](src/algorithms/sets/combinations) (반복 유,무)
- * `A` [최장 공통 부분수열](src/algorithms/sets/longest-common-subsequence) (LCS)
- * `A` [최장 증가 수열](src/algorithms/sets/longest-increasing-subsequence)
- * `A` [Shortest Common Supersequence](src/algorithms/sets/shortest-common-supersequence) (SCS)
- * `A` [배낭 문제](src/algorithms/sets/knapsack-problem) - "0/1" 과 "Unbound"
- * `A` [최대 구간합](src/algorithms/sets/maximum-subarray) - "브루트 포스" 과 "동적 계획법" (Kadane's) 버전
- * `A` [조합 합](src/algorithms/sets/combination-sum) - 특정 합을 구성하는 모든 조합 찾기
-* **Strings**
- * `B` [해밍 거리](src/algorithms/string/hamming-distance) - 심볼이 다른 위치의 갯수
- * `A` [편집 거리](src/algorithms/string/levenshtein-distance) - 두 시퀀스 간위 최소 편집거리
- * `A` [커누스-모리스-프랫 알고리즘](src/algorithms/string/knuth-morris-pratt) (KMP 알고리즘) - 부분 문자열 탐색 (패턴 매칭)
- * `A` [Z 알고리즘](src/algorithms/string/z-algorithm) - 부분 문자열 탐색 (패턴 매칭)
- * `A` [라빈 카프 알고리즘](src/algorithms/string/rabin-karp) - 부분 문자열 탐색
- * `A` [최장 공통 부분 문자열](src/algorithms/string/longest-common-substring)
- * `A` [정규 표현식 매칭](src/algorithms/string/regular-expression-matching)
-* **Searches**
- * `B` [선형 탐색](src/algorithms/search/linear-search)
- * `B` [점프 탐색](src/algorithms/search/jump-search) (or Block Search) - 정렬된 배열에서 탐색
- * `B` [이진 탐색](src/algorithms/search/binary-search) - 정렬된 배열에서 탐색
- * `B` [보간 탐색](src/algorithms/search/interpolation-search) - 균등한 분포를 이루는 정렬된 배열에서 탐색
-* **Sorting**
- * `B` [거품 정렬](src/algorithms/sorting/bubble-sort)
- * `B` [선택 정렬](src/algorithms/sorting/selection-sort)
- * `B` [삽입 정렬](src/algorithms/sorting/insertion-sort)
- * `B` [힙 정렬](src/algorithms/sorting/heap-sort)
- * `B` [병합 정렬](src/algorithms/sorting/merge-sort)
- * `B` [퀵 정렬](src/algorithms/sorting/quick-sort) - 제자리(in-place)와 제자리가 아닌(non-in-place) 구현
- * `B` [셸 정렬](src/algorithms/sorting/shell-sort)
- * `B` [계수 정렬](src/algorithms/sorting/counting-sort)
- * `B` [기수 정렬](src/algorithms/sorting/radix-sort)
-* **Trees**
- * `B` [깊이 우선 탐색](src/algorithms/tree/depth-first-search) (DFS)
- * `B` [너비 우선 탐색](src/algorithms/tree/breadth-first-search) (BFS)
-* **Graphs**
- * `B` [깊이 우선 탐색](src/algorithms/graph/depth-first-search) (DFS)
- * `B` [너비 우선 탐색](src/algorithms/graph/breadth-first-search) (BFS)
- * `B` [크루스칼 알고리즘](src/algorithms/graph/kruskal) - 최소 신장 트리 찾기 (MST) 무방향 가중 그래프
- * `A` [다익스트라 알고리즘](src/algorithms/graph/dijkstra) - 한 점에서 다른 모든 점까지 최단 거리 찾기
- * `A` [벨만-포드 알고리즘](src/algorithms/graph/bellman-ford) - 한 점에서 다른 모든 점까지 최단 거리 찾기
- * `A` [플로이드-워셜 알고리즘](src/algorithms/graph/floyd-warshall) - 모든 종단 간의 최단거리 찾기
- * `A` [사이클 탐지](src/algorithms/graph/detect-cycle) - 유방향, 무방향 그래프 (DFS 와 Disjoint Set 에 기반한 버전)
- * `A` [프림 알고리즘](src/algorithms/graph/prim) - 무방향 가중치 그래프에서 최소 신장 트리 (MST) 찾기
- * `A` [위상 정렬](src/algorithms/graph/topological-sorting) - DFS 방식
- * `A` [단절점](src/algorithms/graph/articulation-points) - 타잔의 알고리즘 (DFS 기반)
- * `A` [단절선](src/algorithms/graph/bridges) - DFS 기반 알고리즘
- * `A` [오일러 경로 와 오일러 회로](src/algorithms/graph/eulerian-path) - Fleury의 알고리즘 - 모든 엣지를 한번만 방문
- * `A` [해밀턴 경로](src/algorithms/graph/hamiltonian-cycle) - 모든 꼭짓점을 한번만 방문
- * `A` [강결합 컴포넌트](src/algorithms/graph/strongly-connected-components) - Kosaraju의 알고리즘
- * `A` [외판원 문제](src/algorithms/graph/travelling-salesman) - 각 도시를 다 방문하고 다시 출발점으로 돌아오는 최단 경로 찾기
-* **Uncategorized**
- * `B` [하노이 탑](src/algorithms/uncategorized/hanoi-tower)
- * `B` [정방 행렬 회전](src/algorithms/uncategorized/square-matrix-rotation) - 제자리(in-place) 알고리즘
- * `B` [점프 게임](src/algorithms/uncategorized/jump-game) - 백트래킹, 동적계획법 (top-down + bottom-up), 탐욕 알고리즘 예제
- * `B` [Unique 경로](src/algorithms/uncategorized/unique-paths) - 백트래킹, 동적계획법, 파스칼 삼각형에 기반한 예제
- * `B` [빗물 담기 문제](src/algorithms/uncategorized/rain-terraces) - trapping rain water problem (동적계획법, 브루트포스 버전)
- * `A` [N-Queens 문제](src/algorithms/uncategorized/n-queens)
- * `A` [기사의 여행 문제](src/algorithms/uncategorized/knight-tour)
+- **Math**
+ - `B` [Bit Manipulation](src/algorithms/math/bits) - set/get/update/clear bits, 2의 곱 / 나누기, 음수로 만들기 etc.
+ - `B` [팩토리얼](src/algorithms/math/factorial)
+ - `B` [피보나치 수](src/algorithms/math/fibonacci)
+ - `B` [소수 판별](src/algorithms/math/primality-test) (trial division 방식)
+ - `B` [유클리드 호제법](src/algorithms/math/euclidean-algorithm) - 최대공약수 (GCD)
+ - `B` [최소 공배수](src/algorithms/math/least-common-multiple) - LCM
+ - `B` [에라토스테네스의 체](src/algorithms/math/sieve-of-eratosthenes) - 특정수 이하의 모든 소수 찾기
+ - `B` [2의 거듭제곱 판별법](src/algorithms/math/is-power-of-two) - 어떤 수가 2의 거듭제곱인지 판별 (naive 와 bitwise 알고리즘)
+ - `B` [파스칼 삼각형](src/algorithms/math/pascal-triangle)
+ - `A` [자연수 분할](src/algorithms/math/integer-partition)
+ - `A` [리우 후이 π 알고리즘](src/algorithms/math/liu-hui) - N-각형을 기반으로 π 근사치 구하기
+- **Sets**
+ - `B` [카티지언 프로덕트](src/algorithms/sets/cartesian-product) - 곱집합
+ - `B` [Fisher–Yates 셔플](src/algorithms/sets/fisher-yates) - 유한 시퀀스의 무작위 순열
+ - `A` [멱집합](src/algorithms/sets/power-set) - 집합의 모든 부분집합
+ - `A` [순열](src/algorithms/sets/permutations) (반복 유,무)
+ - `A` [조합](src/algorithms/sets/combinations) (반복 유,무)
+ - `A` [최장 공통 부분수열](src/algorithms/sets/longest-common-subsequence) (LCS)
+ - `A` [최장 증가 수열](src/algorithms/sets/longest-increasing-subsequence)
+ - `A` [Shortest Common Supersequence](src/algorithms/sets/shortest-common-supersequence) (SCS)
+ - `A` [배낭 문제](src/algorithms/sets/knapsack-problem) - "0/1" 과 "Unbound"
+ - `A` [최대 구간합](src/algorithms/sets/maximum-subarray) - "브루트 포스" 과 "동적 계획법" (Kadane's) 버전
+ - `A` [조합 합](src/algorithms/sets/combination-sum) - 특정 합을 구성하는 모든 조합 찾기
+- **Strings**
+ - `B` [해밍 거리](src/algorithms/string/hamming-distance) - 심볼이 다른 위치의 갯수
+ - `A` [편집 거리](src/algorithms/string/levenshtein-distance) - 두 시퀀스 간위 최소 편집거리
+ - `A` [커누스-모리스-프랫 알고리즘](src/algorithms/string/knuth-morris-pratt) (KMP 알고리즘) - 부분 문자열 탐색 (패턴 매칭)
+ - `A` [Z 알고리즘](src/algorithms/string/z-algorithm) - 부분 문자열 탐색 (패턴 매칭)
+ - `A` [라빈 카프 알고리즘](src/algorithms/string/rabin-karp) - 부분 문자열 탐색
+ - `A` [최장 공통 부분 문자열](src/algorithms/string/longest-common-substring)
+ - `A` [정규 표현식 매칭](src/algorithms/string/regular-expression-matching)
+- **Searches**
+ - `B` [선형 탐색](src/algorithms/search/linear-search)
+ - `B` [점프 탐색](src/algorithms/search/jump-search) (or Block Search) - 정렬된 배열에서 탐색
+ - `B` [이진 탐색](src/algorithms/search/binary-search) - 정렬된 배열에서 탐색
+ - `B` [보간 탐색](src/algorithms/search/interpolation-search) - 균등한 분포를 이루는 정렬된 배열에서 탐색
+- **Sorting**
+ - `B` [거품 정렬](src/algorithms/sorting/bubble-sort)
+ - `B` [선택 정렬](src/algorithms/sorting/selection-sort)
+ - `B` [삽입 정렬](src/algorithms/sorting/insertion-sort)
+ - `B` [힙 정렬](src/algorithms/sorting/heap-sort)
+ - `B` [병합 정렬](src/algorithms/sorting/merge-sort)
+ - `B` [퀵 정렬](src/algorithms/sorting/quick-sort) - 제자리(in-place)와 제자리가 아닌(non-in-place) 구현
+ - `B` [셸 정렬](src/algorithms/sorting/shell-sort)
+ - `B` [계수 정렬](src/algorithms/sorting/counting-sort)
+ - `B` [기수 정렬](src/algorithms/sorting/radix-sort)
+- **Trees**
+ - `B` [깊이 우선 탐색](src/algorithms/tree/depth-first-search) (DFS)
+ - `B` [너비 우선 탐색](src/algorithms/tree/breadth-first-search) (BFS)
+- **Graphs**
+ - `B` [깊이 우선 탐색](src/algorithms/graph/depth-first-search) (DFS)
+ - `B` [너비 우선 탐색](src/algorithms/graph/breadth-first-search) (BFS)
+ - `B` [크루스칼 알고리즘](src/algorithms/graph/kruskal) - 최소 신장 트리 찾기 (MST) 무방향 가중 그래프
+ - `A` [다익스트라 알고리즘](src/algorithms/graph/dijkstra) - 한 점에서 다른 모든 점까지 최단 거리 찾기
+ - `A` [벨만-포드 알고리즘](src/algorithms/graph/bellman-ford) - 한 점에서 다른 모든 점까지 최단 거리 찾기
+ - `A` [플로이드-워셜 알고리즘](src/algorithms/graph/floyd-warshall) - 모든 종단 간의 최단거리 찾기
+ - `A` [사이클 탐지](src/algorithms/graph/detect-cycle) - 유방향, 무방향 그래프 (DFS 와 Disjoint Set 에 기반한 버전)
+ - `A` [프림 알고리즘](src/algorithms/graph/prim) - 무방향 가중치 그래프에서 최소 신장 트리 (MST) 찾기
+ - `A` [위상 정렬](src/algorithms/graph/topological-sorting) - DFS 방식
+ - `A` [단절점](src/algorithms/graph/articulation-points) - 타잔의 알고리즘 (DFS 기반)
+ - `A` [단절선](src/algorithms/graph/bridges) - DFS 기반 알고리즘
+ - `A` [오일러 경로 와 오일러 회로](src/algorithms/graph/eulerian-path) - Fleury의 알고리즘 - 모든 엣지를 한번만 방문
+ - `A` [해밀턴 경로](src/algorithms/graph/hamiltonian-cycle) - 모든 꼭짓점을 한번만 방문
+ - `A` [강결합 컴포넌트](src/algorithms/graph/strongly-connected-components) - Kosaraju의 알고리즘
+ - `A` [외판원 문제](src/algorithms/graph/travelling-salesman) - 각 도시를 다 방문하고 다시 출발점으로 돌아오는 최단 경로 찾기
+- **Uncategorized**
+ - `B` [하노이 탑](src/algorithms/uncategorized/hanoi-tower)
+ - `B` [정방 행렬 회전](src/algorithms/uncategorized/square-matrix-rotation) - 제자리(in-place) 알고리즘
+ - `B` [점프 게임](src/algorithms/uncategorized/jump-game) - 백트래킹, 동적계획법 (top-down + bottom-up), 탐욕 알고리즘 예제
+ - `B` [Unique 경로](src/algorithms/uncategorized/unique-paths) - 백트래킹, 동적계획법, 파스칼 삼각형에 기반한 예제
+ - `B` [빗물 담기 문제](src/algorithms/uncategorized/rain-terraces) - trapping rain water problem (동적계획법, 브루트포스 버전)
+ - `A` [N-Queens 문제](src/algorithms/uncategorized/n-queens)
+ - `A` [기사의 여행 문제](src/algorithms/uncategorized/knight-tour)
### 패러다임별 알고리즘
알고리즘 패러다임 이란, 알고리즘이 주어진 문제를 해결하기 위해 채택한 기초가 되는 일반적인 방법 혹은 접근법입니다. 알고리즘이 해결하는 문제나 알고리즘의 동작 방식이 완전히 다르더라도,알고리즘의 동작 원칙이 같으면 같은 패러다음을 사용했다고 말할 수 있으며, 주로 알고리즘을 구분하는 기준으로 쓰인다. 알고리즘이 일반적인 컴퓨터의 프로그램에 대한 개념보다 보다 더 추상적인 개념인 것처럼 알고리즘의 패러다임은 명확히 정의된 수학적 실체가 있는 것이 아니기 때문에 그 어떤 알고리즘의 개념보다도 훨씬 추상적인 개념이다.
-* **브루트 포스(Brute Force)** - 가능한 모든 경우를 탐색한 뒤 최적을 찾아내는 방식입니다.
- * `B` [선형 탐색](src/algorithms/search/linear-search)
- * `B` [빗물 담기 문제](src/algorithms/uncategorized/rain-terraces) - trapping rain water problem
- * `A` [최대 구간합](src/algorithms/sets/maximum-subarray)
- * `A` [외판원 문제](src/algorithms/graph/travelling-salesman) - 각 도시를 다 방문하고 다시 출발점으로 돌아오는 최단 경로 찾기
-* **탐욕 알고리즘(Greedy)** - 이후를 고려하지 않고 현재 시점에서 가장 최적인 선택을 하는 방식입니다.
- * `B` [점프 게임](src/algorithms/uncategorized/jump-game)
- * `A` [쪼갤수 있는 배낭 문제](src/algorithms/sets/knapsack-problem)
- * `A` [다익스트라 알고리즘](src/algorithms/graph/dijkstra) - 모든 점 까지의 최단거리 찾기
- * `A` [프림 알고리즘](src/algorithms/graph/prim) - 무방향 가중치 그래프에서 최소 신창 트리 (MST) 찾기
- * `A` [크루스칼 알고리즘](src/algorithms/graph/kruskal) - 무방향 가중치 그래프에서 최소 신창 트리 (MST) 찾기
-* **분할 정복법(Divide and Conquer)** - 문제를 여러 작은 문제로 분할한 뒤 해결하는 방식입니다.
- * `B` [이진 탐색](src/algorithms/search/binary-search)
- * `B` [하노이 탑](src/algorithms/uncategorized/hanoi-tower)
- * `B` [파스칼 삼각형](src/algorithms/math/pascal-triangle)
- * `B` [유클리드 호제법](src/algorithms/math/euclidean-algorithm) - 최대공약수 계산 (GCD)
- * `B` [병합 정렬](src/algorithms/sorting/merge-sort)
- * `B` [퀵 정렬](src/algorithms/sorting/quick-sort)
- * `B` [트리 깊이 우선 탐색](src/algorithms/tree/depth-first-search) (DFS)
- * `B` [그래프 깊이 우선 탐색](src/algorithms/graph/depth-first-search) (DFS)
- * `B` [점프 게임](src/algorithms/uncategorized/jump-game)
- * `A` [순열](src/algorithms/sets/permutations) (반복 유,무)
- * `A` [조합](src/algorithms/sets/combinations) (반복 유,무)
-* **동적 계획법(Dynamic Programming)** - 이전에 찾은 결과를 이용하여 최종적으로 해결하는 방식입니다.
- * `B` [피보나치 수](src/algorithms/math/fibonacci)
- * `B` [점프 게임](src/algorithms/uncategorized/jump-game)
- * `B` [Unique Paths](src/algorithms/uncategorized/unique-paths)
- * `B` [빗물 담기 문제](src/algorithms/uncategorized/rain-terraces) - trapping rain water problem
- * `A` [편집 거리](src/algorithms/string/levenshtein-distance) - 두 시퀀스 간의 최소 편집 거리
- * `A` [최장 공통 부분 수열](src/algorithms/sets/longest-common-subsequence) (LCS)
- * `A` [최장 공통 부분 문자열](src/algorithms/string/longest-common-substring)
- * `A` [최장 증가 수열](src/algorithms/sets/longest-increasing-subsequence)
- * `A` [Shortest Common Supersequence](src/algorithms/sets/shortest-common-supersequence)
- * `A` [0/1 배낭 문제](src/algorithms/sets/knapsack-problem)
- * `A` [자연수 분할](src/algorithms/math/integer-partition)
- * `A` [최대 구간합](src/algorithms/sets/maximum-subarray)
- * `A` [벨만-포드 알고리즘](src/algorithms/graph/bellman-ford) - 모든 점 까지의 최단 거리 찾기
- * `A` [플로이드-워셜 알고리즘](src/algorithms/graph/floyd-warshall) - 모든 종단 간의 최단거리 찾기
- * `A` [정규 표현식 매칭](src/algorithms/string/regular-expression-matching)
-* **백트래킹(Backtracking)** - 모든 가능한 경우를 고려한다는 점에서 브루트 포스와 유사합니다. 하지만 다음 단계로 넘어갈때 마다 모든 조건을 만족했는지 확인하고 진행합니다. 만약 조건을 만족하지 못했다면 뒤로 돌아갑니다 (백트래킹). 그리고 다른 경로를 선택합니다. 보통 상태를 유지한 DFS 탐색을 많이 사용합니다.
- * `B` [점프 게임](src/algorithms/uncategorized/jump-game)
- * `B` [Unique Paths](src/algorithms/uncategorized/unique-paths)
- * `A` [해밀턴 경로](src/algorithms/graph/hamiltonian-cycle) - 모든 점을 한번씩 방문
- * `A` [N-Queens 문제](src/algorithms/uncategorized/n-queens)
- * `A` [기사의 여행](src/algorithms/uncategorized/knight-tour)
- * `A` [조합 합](src/algorithms/sets/combination-sum) - 특정 합을 구성하는 모든 조합 찾기
-* **분기 한정법** - 백트래킹으로 찾은 각 단계의 최소 비용이 드는 해를 기억해 두고 있다가, 이 비용을 이용해서 더 낮은 최적의 해를 찾습니다. 기억해둔 최소 비용들을 이용해 더 높은 비용이 드는 해결법을 탐색 안함으로써 불필요한 시간 소모를 줄입니다. 보통 상태 공간 트리의 DFS 탐색을 이용한 BFS 탐색 방식에서 사용됩니다.
+- **브루트 포스(Brute Force)** - 가능한 모든 경우를 탐색한 뒤 최적을 찾아내는 방식입니다.
+ - `B` [선형 탐색](src/algorithms/search/linear-search)
+ - `B` [빗물 담기 문제](src/algorithms/uncategorized/rain-terraces) - trapping rain water problem
+ - `A` [최대 구간합](src/algorithms/sets/maximum-subarray)
+ - `A` [외판원 문제](src/algorithms/graph/travelling-salesman) - 각 도시를 다 방문하고 다시 출발점으로 돌아오는 최단 경로 찾기
+- **탐욕 알고리즘(Greedy)** - 이후를 고려하지 않고 현재 시점에서 가장 최적인 선택을 하는 방식입니다.
+ - `B` [점프 게임](src/algorithms/uncategorized/jump-game)
+ - `A` [쪼갤수 있는 배낭 문제](src/algorithms/sets/knapsack-problem)
+ - `A` [다익스트라 알고리즘](src/algorithms/graph/dijkstra) - 모든 점 까지의 최단거리 찾기
+ - `A` [프림 알고리즘](src/algorithms/graph/prim) - 무방향 가중치 그래프에서 최소 신창 트리 (MST) 찾기
+ - `A` [크루스칼 알고리즘](src/algorithms/graph/kruskal) - 무방향 가중치 그래프에서 최소 신창 트리 (MST) 찾기
+- **분할 정복법(Divide and Conquer)** - 문제를 여러 작은 문제로 분할한 뒤 해결하는 방식입니다.
+ - `B` [이진 탐색](src/algorithms/search/binary-search)
+ - `B` [하노이 탑](src/algorithms/uncategorized/hanoi-tower)
+ - `B` [파스칼 삼각형](src/algorithms/math/pascal-triangle)
+ - `B` [유클리드 호제법](src/algorithms/math/euclidean-algorithm) - 최대공약수 계산 (GCD)
+ - `B` [병합 정렬](src/algorithms/sorting/merge-sort)
+ - `B` [퀵 정렬](src/algorithms/sorting/quick-sort)
+ - `B` [트리 깊이 우선 탐색](src/algorithms/tree/depth-first-search) (DFS)
+ - `B` [그래프 깊이 우선 탐색](src/algorithms/graph/depth-first-search) (DFS)
+ - `B` [점프 게임](src/algorithms/uncategorized/jump-game)
+ - `A` [순열](src/algorithms/sets/permutations) (반복 유,무)
+ - `A` [조합](src/algorithms/sets/combinations) (반복 유,무)
+- **동적 계획법(Dynamic Programming)** - 이전에 찾은 결과를 이용하여 최종적으로 해결하는 방식입니다.
+ - `B` [피보나치 수](src/algorithms/math/fibonacci)
+ - `B` [점프 게임](src/algorithms/uncategorized/jump-game)
+ - `B` [Unique Paths](src/algorithms/uncategorized/unique-paths)
+ - `B` [빗물 담기 문제](src/algorithms/uncategorized/rain-terraces) - trapping rain water problem
+ - `A` [편집 거리](src/algorithms/string/levenshtein-distance) - 두 시퀀스 간의 최소 편집 거리
+ - `A` [최장 공통 부분 수열](src/algorithms/sets/longest-common-subsequence) (LCS)
+ - `A` [최장 공통 부분 문자열](src/algorithms/string/longest-common-substring)
+ - `A` [최장 증가 수열](src/algorithms/sets/longest-increasing-subsequence)
+ - `A` [Shortest Common Supersequence](src/algorithms/sets/shortest-common-supersequence)
+ - `A` [0/1 배낭 문제](src/algorithms/sets/knapsack-problem)
+ - `A` [자연수 분할](src/algorithms/math/integer-partition)
+ - `A` [최대 구간합](src/algorithms/sets/maximum-subarray)
+ - `A` [벨만-포드 알고리즘](src/algorithms/graph/bellman-ford) - 모든 점 까지의 최단 거리 찾기
+ - `A` [플로이드-워셜 알고리즘](src/algorithms/graph/floyd-warshall) - 모든 종단 간의 최단거리 찾기
+ - `A` [정규 표현식 매칭](src/algorithms/string/regular-expression-matching)
+- **백트래킹(Backtracking)** - 모든 가능한 경우를 고려한다는 점에서 브루트 포스와 유사합니다. 하지만 다음 단계로 넘어갈때 마다 모든 조건을 만족했는지 확인하고 진행합니다. 만약 조건을 만족하지 못했다면 뒤로 돌아갑니다 (백트래킹). 그리고 다른 경로를 선택합니다. 보통 상태를 유지한 DFS 탐색을 많이 사용합니다.
+ - `B` [점프 게임](src/algorithms/uncategorized/jump-game)
+ - `B` [Unique Paths](src/algorithms/uncategorized/unique-paths)
+ - `A` [해밀턴 경로](src/algorithms/graph/hamiltonian-cycle) - 모든 점을 한번씩 방문
+ - `A` [N-Queens 문제](src/algorithms/uncategorized/n-queens)
+ - `A` [기사의 여행](src/algorithms/uncategorized/knight-tour)
+ - `A` [조합 합](src/algorithms/sets/combination-sum) - 특정 합을 구성하는 모든 조합 찾기
+- **분기 한정법** - 백트래킹으로 찾은 각 단계의 최소 비용이 드는 해를 기억해 두고 있다가, 이 비용을 이용해서 더 낮은 최적의 해를 찾습니다. 기억해둔 최소 비용들을 이용해 더 높은 비용이 드는 해결법을 탐색 안함으로써 불필요한 시간 소모를 줄입니다. 보통 상태 공간 트리의 DFS 탐색을 이용한 BFS 탐색 방식에서 사용됩니다.
## 이 저장소의 사용법
**모든 종속 모듈들 설치**
+
```
npm install
```
@@ -197,18 +198,20 @@ npm run lint
```
**모든 테스트 실행**
+
```
npm test
```
**이름을 통해 특정 테스트 실행**
+
```
npm test -- 'LinkedList'
```
**Playground**
- `./src/playground/playground.js` 파일을 통해 자료 구조와 알고리즘을 작성하고 `./src/playground/__test__/playground.test.js`에 테스트를 작성할 수 있습니다.
+`./src/playground/playground.js` 파일을 통해 자료 구조와 알고리즘을 작성하고 `./src/playground/__test__/playground.test.js`에 테스트를 작성할 수 있습니다.
그리고 간단하게 아래 명령어를 통해 의도한대로 동작하는지 확인 할 수 있습니다.:
@@ -232,41 +235,41 @@ Source: [Big O Cheat Sheet](http://bigocheatsheet.com/).
아래는 가장 많이 사용되는 Big O 표기와 입력 데이터 크기에 따른 성능을 비교한 표입니다.
-| Big O 표기 | 10 개 일때 | 100 개 일때 | 1000 개 일때 |
-| -------------- | ---------------------------- | ----------------------------- | ------------------------------- |
-| **O(1)** | 1 | 1 | 1 |
-| **O(log N)** | 3 | 6 | 9 |
-| **O(N)** | 10 | 100 | 1000 |
-| **O(N log N)** | 30 | 600 | 9000 |
-| **O(N^2)** | 100 | 10000 | 1000000 |
-| **O(2^N)** | 1024 | 1.26e+29 | 1.07e+301 |
-| **O(N!)** | 3628800 | 9.3e+157 | 4.02e+2567 |
+| Big O 표기 | 10 개 일때 | 100 개 일때 | 1000 개 일때 |
+| -------------- | ---------- | ----------- | ------------ |
+| **O(1)** | 1 | 1 | 1 |
+| **O(log N)** | 3 | 6 | 9 |
+| **O(N)** | 10 | 100 | 1000 |
+| **O(N log N)** | 30 | 600 | 9000 |
+| **O(N^2)** | 100 | 10000 | 1000000 |
+| **O(2^N)** | 1024 | 1.26e+29 | 1.07e+301 |
+| **O(N!)** | 3628800 | 9.3e+157 | 4.02e+2567 |
### 자료 구조 작업별 복잡도
-| 자료 구조 | 접근 | 검색 | 삽입 | 삭제 | 비고 |
-| ------------------------ | :-------: | :-------: | :-------: | :-------: | :-------- |
-| **배열** | 1 | n | n | n | |
-| **스택** | n | n | 1 | 1 | |
-| **큐** | n | n | 1 | 1 | |
-| **연결 리스트** | n | n | 1 | 1 | |
-| **해시 테이블** | - | n | n | n | 완벽한 해시 함수의 경우 O(1) |
-| **이진 탐색 트리** | n | n | n | n | 균형 트리의 경우 O(log(n)) |
-| **B-트리** | log(n) | log(n) | log(n) | log(n) | |
-| **Red-Black 트리** | log(n) | log(n) | log(n) | log(n) | |
-| **AVL 트리** | log(n) | log(n) | log(n) | log(n) | |
-| **Bloom Filter** | - | 1 | 1 | - | 거짓 양성이 탐색 중 발생 가능 |
+| 자료 구조 | 접근 | 검색 | 삽입 | 삭제 | 비고 |
+| ------------------ | :----: | :----: | :----: | :----: | :---------------------------- |
+| **배열** | 1 | n | n | n | |
+| **스택** | n | n | 1 | 1 | |
+| **큐** | n | n | 1 | 1 | |
+| **연결 리스트** | n | n | 1 | 1 | |
+| **해시 테이블** | - | n | n | n | 완벽한 해시 함수의 경우 O(1) |
+| **이진 탐색 트리** | n | n | n | n | 균형 트리의 경우 O(log(n)) |
+| **B-트리** | log(n) | log(n) | log(n) | log(n) | |
+| **Red-Black 트리** | log(n) | log(n) | log(n) | log(n) | |
+| **AVL 트리** | log(n) | log(n) | log(n) | log(n) | |
+| **Bloom Filter** | - | 1 | 1 | - | 거짓 양성이 탐색 중 발생 가능 |
### 정렬 알고리즘 복잡도
-| 이름 | 최적 | 평균 | 최악 | 메모리 | 동일값 순서유지 | 비고 |
-| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :--------------: | :-------- |
-| **거품 정렬** | n | n2 | n2 | 1 | Yes | |
-| **삽입 정렬** | n | n2 | n2 | 1 | Yes | |
-| **선택 정렬** | n2 | n2 | n2 | 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) | n2 | 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 - 키값의 최대 길이 |
+| 이름 | 최적 | 평균 | 최악 | 메모리 | 동일값 순서유지 | 비고 |
+| ------------- | :-----------: | :--------------------------: | :-------------------------: | :----: | :-------------: | :------------------------------------------------------------------- |
+| **거품 정렬** | n | n2 | n2 | 1 | Yes | |
+| **삽입 정렬** | n | n2 | n2 | 1 | Yes | |
+| **선택 정렬** | n2 | n2 | n2 | 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) | n2 | 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 - 키값의 최대 길이 |
diff --git a/README.md b/README.md
index 1c3200efee..24fcb7df62 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,8 @@ _Read this in other languages:_
[_Polski_](README.pl-PL.md),
[_Français_](README.fr-FR.md),
[_Español_](README.es-ES.md),
-[_Português_](README.pt-BR.md)
+[_Português_](README.pt-BR.md),
+[_Русский_](README.ru-RU.md)
*☝ Note that this project is meant to be used for learning and researching purposes
only and it is **not** meant to be used for production.*
diff --git a/README.pl-PL.md b/README.pl-PL.md
index 4aa25e8d37..96e457d33b 100644
--- a/README.pl-PL.md
+++ b/README.pl-PL.md
@@ -3,11 +3,11 @@
[](https://travis-ci.org/trekhleb/javascript-algorithms)
[](https://codecov.io/gh/trekhleb/javascript-algorithms)
-To repozytorium zawiera wiele przykładów JavaScript opartych na
+To repozytorium zawiera wiele przykładów JavaScript opartych na
znanych algorytmach i strukturach danych.
Każdy algorytm i struktura danych zawiera osobny plik README
-wraz z powiązanymi wyjaśnieniami i odnośnikami do dalszego czytania
+wraz z powiązanymi wyjaśnieniami i odnośnikami do dalszego czytania
(włącznie z tymi do YouTube videos).
_Read this in other languages:_
@@ -18,183 +18,185 @@ _Read this in other languages:_
[_日本語_](README.ja-JP.md),
[_Français_](README.fr-FR.md),
[_Español_](README.es-ES.md),
-[_Português_](README.pt-BR.md)
+[_Português_](README.pt-BR.md),
+[_Русский_](README.ru-RU.md)
## Struktury Danych
-Struktura danych to sposób uporządkowania i przechowywania informacji w
+Struktura danych to sposób uporządkowania i przechowywania informacji w
komputerze żeby mogłaby być sprawnie dostępna i efektywnie zmodyfikowana.
-Dokładniej, struktura danych jest zbiorem wartości danych, relacjami
-pomiędzy nimi, zadaniami lub działaniami, które mogą dotyczyć danych.
+Dokładniej, struktura danych jest zbiorem wartości danych, relacjami
+pomiędzy nimi, zadaniami lub działaniami, które mogą dotyczyć danych.
`B` - Początkujący, `A` - Zaawansowany
-* `B` [Lista](src/data-structures/linked-list)
-* `B` [Lista Dwukierunkowa](src/data-structures/doubly-linked-list)
-* `B` [Kolejka](src/data-structures/queue)
-* `B` [Stos](src/data-structures/stack)
-* `B` [Tabela Skrótu](src/data-structures/hash-table)
-* `B` [Sterta](src/data-structures/heap)
-* `B` [Kolejka Priorytetowa](src/data-structures/priority-queue)
-* `A` [Trie](src/data-structures/trie)
-* `A` [Drzewo](src/data-structures/tree)
- * `A` [Wyszukiwanie Binarne](src/data-structures/tree/binary-search-tree)
- * `A` [AVL Drzewo](src/data-structures/tree/avl-tree)
- * `A` [Drzewa czerwono-czarne](src/data-structures/tree/red-black-tree)
- * `A` [Drzewo Segmentu](src/data-structures/tree/segment-tree) - z przykładami zapytań o min / max / sumie sum
- * `A` [Drzewo Fenwicka](src/data-structures/tree/fenwick-tree) (Drzewo Indeksowane Binarnie)
-* `A` [Graf](src/data-structures/graph) (zarówno skierowane i nieukierunkowane)
-* `A` [Rozłączny Zestaw](src/data-structures/disjoint-set)
-* `A` [Filtr Blooma](src/data-structures/bloom-filter)
+- `B` [Lista](src/data-structures/linked-list)
+- `B` [Lista Dwukierunkowa](src/data-structures/doubly-linked-list)
+- `B` [Kolejka](src/data-structures/queue)
+- `B` [Stos](src/data-structures/stack)
+- `B` [Tabela Skrótu](src/data-structures/hash-table)
+- `B` [Sterta](src/data-structures/heap)
+- `B` [Kolejka Priorytetowa](src/data-structures/priority-queue)
+- `A` [Trie](src/data-structures/trie)
+- `A` [Drzewo](src/data-structures/tree)
+ - `A` [Wyszukiwanie Binarne](src/data-structures/tree/binary-search-tree)
+ - `A` [AVL Drzewo](src/data-structures/tree/avl-tree)
+ - `A` [Drzewa czerwono-czarne](src/data-structures/tree/red-black-tree)
+ - `A` [Drzewo Segmentu](src/data-structures/tree/segment-tree) - z przykładami zapytań o min / max / sumie sum
+ - `A` [Drzewo Fenwicka](src/data-structures/tree/fenwick-tree) (Drzewo Indeksowane Binarnie)
+- `A` [Graf](src/data-structures/graph) (zarówno skierowane i nieukierunkowane)
+- `A` [Rozłączny Zestaw](src/data-structures/disjoint-set)
+- `A` [Filtr Blooma](src/data-structures/bloom-filter)
## Algorytmy
-Algorytm jest to skończony ciąg jasno zdefiniowanych czynności, koniecznych
-do wykonania pewnego rodzaju zadań. Sposób postępowania prowadzący do
+Algorytm jest to skończony ciąg jasno zdefiniowanych czynności, koniecznych
+do wykonania pewnego rodzaju zadań. Sposób postępowania prowadzący do
rozwiązania problemu.
`B` - Początkujący, `A` - Zaawansowany
### Algorytmy według tematu
-* **Matematyka**
- * `B` [Manipulacja Bitami](src/algorithms/math/bits) - ustaw / uzyskaj / aktualizuj / usuwaj bity, mnożenie / dzielenie przez dwa, tworzenie negatywów itp.
- * `B` [Silna](src/algorithms/math/factorial)
- * `B` [Ciąg Fibonacciego](src/algorithms/math/fibonacci)
- * `B` [Test Pierwszorzędności](src/algorithms/math/primality-test) (metoda podziału na próby)
- * `B` [Algorytm Euclideana](src/algorithms/math/euclidean-algorithm) - obliczyć Największy Wspólny Dzielnik (GCD)
- * `B` [Najmniejsza Wspólna Wielokrotność](src/algorithms/math/least-common-multiple) (LCM)
- * `B` [Sito Eratosthenes-a](src/algorithms/math/sieve-of-eratosthenes) - znajdowanie wszystkich liczb pierwszych do określonego limitu
- * `B` [Jest Potęgą Dwójki](src/algorithms/math/is-power-of-two) - sprawdź, czy liczba jest potęgą dwóch (algorytmy naiwne i bitowe)
- * `B` [Trójkąt Pascala](src/algorithms/math/pascal-triangle)
- * `A` [Partycja Całkowita](src/algorithms/math/integer-partition)
- * `A` [Algorytm Liu Huia](src/algorithms/math/liu-hui) - przybliżone obliczenia na podstawie N-gonów
-* **Zestawy**
- * `B` [Produkt Kartezyjny](src/algorithms/sets/cartesian-product) - wynik wielu zestawów
- * `B` [Przetasowanie Fisher Yates-a](src/algorithms/sets/fisher-yates) - losowa permutacja kończącej się serii
- * `A` [Zestaw Zasilający](src/algorithms/sets/power-set) - podzbiór wszystkich serii
- * `A` [Permutacje](src/algorithms/sets/permutations) (z albo bez powtórzeń)
- * `A` [Kombinacje](src/algorithms/sets/combinations) (z albo bez powtórzeń)
- * `A` [Najdłuższa Wspólna Podsekwencja](src/algorithms/sets/longest-common-subsequence) (LCS)
- * `A` [Najdłuższa Wzrostająca Podsekwencja](src/algorithms/sets/longest-increasing-subsequence)
- * `A` [Najkrótsza Wspólna Supersekwencja](src/algorithms/sets/shortest-common-supersequence) (SCS)
- * `A` [Problem Knapsacka](src/algorithms/sets/knapsack-problem) - "0/1" i "Rozwiązany"
- * `A` [Maksymalna Podtablica](src/algorithms/sets/maximum-subarray) - "Metoda Siłowa" i "Dynamiczne Programowanie" (Kadane-a) wersje
- * `A` [Suma Kombinacji](src/algorithms/sets/combination-sum) -
-znajdź wszystkie kombinacje, które tworzą określoną sumę
-* **Łańcuchy**
- * `B` [Odległość Hamminga](src/algorithms/string/hamming-distance) - liczba pozycji, w których symbole są różne
- * `A` [Odległość Levenshteina](src/algorithms/string/levenshtein-distance) - minimalna odległość edycji między dwiema sekwencjami
- * `A` [Algorytm Knuth–Morris–Pratta](src/algorithms/string/knuth-morris-pratt) (Algorytm KMP) - dopasowywanie wzorców (dopasowywanie wzorców)
- * `A` [Algorytm Z](src/algorithms/string/z-algorithm) - szukanie podłańcucha(dopasowywanie wzorców)
- * `A` [Algorytm Rabin Karpa](src/algorithms/string/rabin-karp) - szukanie podłańcucha
- * `A` [Najdłuższa Wspólna Podłańcucha](src/algorithms/string/longest-common-substring)
- * `A` [Dopasowanie Wyrażeń Regularnych](src/algorithms/string/regular-expression-matching)
-* **Szukanie**
- * `B` [Wyszukiwanie Liniowe](src/algorithms/search/linear-search)
- * `B` [Jump Search](src/algorithms/search/jump-search) (lub Przeszukiwanie Bloku) - szukaj w posortowanej tablicy
- * `B` [Wyszukiwanie Binarne](src/algorithms/search/binary-search) - szukaj w posortowanej tablicy
- * `B` [Wyszukiwanie Interpolacyjne](src/algorithms/search/interpolation-search) - szukaj w równomiernie rozłożonej, posortowanej tablicy
-* **Sortowanie**
- * `B` [Sortowanie bąbelkowe](src/algorithms/sorting/bubble-sort)
- * `B` [Sortowanie przez wymiane](src/algorithms/sorting/selection-sort)
- * `B` [Sortowanie przez wstawianie](src/algorithms/sorting/insertion-sort)
- * `B` [Sortowanie stogowe](src/algorithms/sorting/heap-sort)
- * `B` [Sortowanie przez scalanie](src/algorithms/sorting/merge-sort)
- * `B` [Sortowanie szybkie](src/algorithms/sorting/quick-sort) - wdrożenia w miejscu i nie na miejscu
- * `B` [Sortowanie Shella](src/algorithms/sorting/shell-sort)
- * `B` [Sortowanie przez zliczanie](src/algorithms/sorting/counting-sort)
- * `B` [Sortowanie pozycyjne](src/algorithms/sorting/radix-sort)
-* **Drzewa**
- * `B` [Przeszukiwanie w głąb](src/algorithms/tree/depth-first-search) (DFS)
- * `B` [Przeszukiwanie wszerz](src/algorithms/tree/breadth-first-search) (BFS)
-* **Grafy**
- * `B` [Przeszukiwanie w głąb](src/algorithms/graph/depth-first-search) (DFS)
- * `B` [Przeszukiwanie wszerz](src/algorithms/graph/breadth-first-search) (BFS)
- * `B` [Algorytm Kruskala](src/algorithms/graph/kruskal) - znalezienie Minimalnego Drzewa Opinającego (MST) dla ważonego nieukierunkowanego wykresu
- * `A` [Algorytm Dijkstry](src/algorithms/graph/dijkstra) - znajdowanie najkrótszej ścieżki z pojedynczego źródła w grafie
- * `A` [Algorytm Bellmana-Forda](src/algorithms/graph/bellman-ford) - znajdowanie najkrótszych ścieżek do wszystkich wierzchołków wykresu z jednego wierzchołka
- * `A` [Algorytm Floyd-Warshalla](src/algorithms/graph/floyd-warshall) - znajdź najkrótsze ścieżki między wszystkimi parami wierzchołków
- * `A` [Detect Cycle](src/algorithms/graph/detect-cycle) - zarówno dla wykresów skierowanych, jak i nieukierunkowanych(wersje oparte na DFS i Rozłączny Zestaw)
- * `A` [Algorytm Prima](src/algorithms/graph/prim) - znalezienie Minimalnego Drzewa Opinającego (MST) dla ważonego nieukierunkowanego wykresu
- * `A` [Sortowanie Topologiczne](src/algorithms/graph/topological-sorting) - metoda DFS
- * `A` [Punkty Artykulacji](src/algorithms/graph/articulation-points) - Algorytm Tarjana (oparty o DFS)
- * `A` [Mosty](src/algorithms/graph/bridges) - Oparty na algorytmie DFS
- * `A` [Ścieżka Euleriana i Obwód Euleriana](src/algorithms/graph/eulerian-path) - Algorytm Fleurya - Odwiedź każdą krawędź dokładnie raz
- * `A` [Cykl Hamiltoniana](src/algorithms/graph/hamiltonian-cycle) - Odwiedź każdy wierzchołek dokładnie raz
- * `A` [Silnie Połączone Komponenty](src/algorithms/graph/strongly-connected-components) - Algorytm Kosaraja
- * `A` [Travelling Salesman Problem](src/algorithms/graph/travelling-salesman) - najkrótsza ścieżka która odwiedza każde miasto i wraca miasta początkującego
-* **Niezkategorizowane**
- * `B` [Wieża Hanoi](src/algorithms/uncategorized/hanoi-tower)
- * `B` [Kwadratowa Matryca Obrotu](src/algorithms/uncategorized/square-matrix-rotation) - algorytm w miejscu
- * `B` [Jump Game](src/algorithms/uncategorized/jump-game) - cofanie, dynamiczne programowanie (od góry do dołu + od dołu do góry) i przykłady chciwego
- * `B` [Unikatowe Ścieżki](src/algorithms/uncategorized/unique-paths) - cofanie, dynamiczne programowanie i przykłady oparte na Trójkącie Pascala
- * `A` [Problem N-Queens](src/algorithms/uncategorized/n-queens)
- * `A` [Knight's Tour](src/algorithms/uncategorized/knight-tour)
+- **Matematyka**
+ - `B` [Manipulacja Bitami](src/algorithms/math/bits) - ustaw / uzyskaj / aktualizuj / usuwaj bity, mnożenie / dzielenie przez dwa, tworzenie negatywów itp.
+ - `B` [Silna](src/algorithms/math/factorial)
+ - `B` [Ciąg Fibonacciego](src/algorithms/math/fibonacci)
+ - `B` [Test Pierwszorzędności](src/algorithms/math/primality-test) (metoda podziału na próby)
+ - `B` [Algorytm Euclideana](src/algorithms/math/euclidean-algorithm) - obliczyć Największy Wspólny Dzielnik (GCD)
+ - `B` [Najmniejsza Wspólna Wielokrotność](src/algorithms/math/least-common-multiple) (LCM)
+ - `B` [Sito Eratosthenes-a](src/algorithms/math/sieve-of-eratosthenes) - znajdowanie wszystkich liczb pierwszych do określonego limitu
+ - `B` [Jest Potęgą Dwójki](src/algorithms/math/is-power-of-two) - sprawdź, czy liczba jest potęgą dwóch (algorytmy naiwne i bitowe)
+ - `B` [Trójkąt Pascala](src/algorithms/math/pascal-triangle)
+ - `A` [Partycja Całkowita](src/algorithms/math/integer-partition)
+ - `A` [Algorytm Liu Huia](src/algorithms/math/liu-hui) - przybliżone obliczenia na podstawie N-gonów
+- **Zestawy**
+ - `B` [Produkt Kartezyjny](src/algorithms/sets/cartesian-product) - wynik wielu zestawów
+ - `B` [Przetasowanie Fisher Yates-a](src/algorithms/sets/fisher-yates) - losowa permutacja kończącej się serii
+ - `A` [Zestaw Zasilający](src/algorithms/sets/power-set) - podzbiór wszystkich serii
+ - `A` [Permutacje](src/algorithms/sets/permutations) (z albo bez powtórzeń)
+ - `A` [Kombinacje](src/algorithms/sets/combinations) (z albo bez powtórzeń)
+ - `A` [Najdłuższa Wspólna Podsekwencja](src/algorithms/sets/longest-common-subsequence) (LCS)
+ - `A` [Najdłuższa Wzrostająca Podsekwencja](src/algorithms/sets/longest-increasing-subsequence)
+ - `A` [Najkrótsza Wspólna Supersekwencja](src/algorithms/sets/shortest-common-supersequence) (SCS)
+ - `A` [Problem Knapsacka](src/algorithms/sets/knapsack-problem) - "0/1" i "Rozwiązany"
+ - `A` [Maksymalna Podtablica](src/algorithms/sets/maximum-subarray) - "Metoda Siłowa" i "Dynamiczne Programowanie" (Kadane-a) wersje
+ - `A` [Suma Kombinacji](src/algorithms/sets/combination-sum) -
+ znajdź wszystkie kombinacje, które tworzą określoną sumę
+- **Łańcuchy**
+ - `B` [Odległość Hamminga](src/algorithms/string/hamming-distance) - liczba pozycji, w których symbole są różne
+ - `A` [Odległość Levenshteina](src/algorithms/string/levenshtein-distance) - minimalna odległość edycji między dwiema sekwencjami
+ - `A` [Algorytm Knuth–Morris–Pratta](src/algorithms/string/knuth-morris-pratt) (Algorytm KMP) - dopasowywanie wzorców (dopasowywanie wzorców)
+ - `A` [Algorytm Z](src/algorithms/string/z-algorithm) - szukanie podłańcucha(dopasowywanie wzorców)
+ - `A` [Algorytm Rabin Karpa](src/algorithms/string/rabin-karp) - szukanie podłańcucha
+ - `A` [Najdłuższa Wspólna Podłańcucha](src/algorithms/string/longest-common-substring)
+ - `A` [Dopasowanie Wyrażeń Regularnych](src/algorithms/string/regular-expression-matching)
+- **Szukanie**
+ - `B` [Wyszukiwanie Liniowe](src/algorithms/search/linear-search)
+ - `B` [Jump Search](src/algorithms/search/jump-search) (lub Przeszukiwanie Bloku) - szukaj w posortowanej tablicy
+ - `B` [Wyszukiwanie Binarne](src/algorithms/search/binary-search) - szukaj w posortowanej tablicy
+ - `B` [Wyszukiwanie Interpolacyjne](src/algorithms/search/interpolation-search) - szukaj w równomiernie rozłożonej, posortowanej tablicy
+- **Sortowanie**
+ - `B` [Sortowanie bąbelkowe](src/algorithms/sorting/bubble-sort)
+ - `B` [Sortowanie przez wymiane](src/algorithms/sorting/selection-sort)
+ - `B` [Sortowanie przez wstawianie](src/algorithms/sorting/insertion-sort)
+ - `B` [Sortowanie stogowe](src/algorithms/sorting/heap-sort)
+ - `B` [Sortowanie przez scalanie](src/algorithms/sorting/merge-sort)
+ - `B` [Sortowanie szybkie](src/algorithms/sorting/quick-sort) - wdrożenia w miejscu i nie na miejscu
+ - `B` [Sortowanie Shella](src/algorithms/sorting/shell-sort)
+ - `B` [Sortowanie przez zliczanie](src/algorithms/sorting/counting-sort)
+ - `B` [Sortowanie pozycyjne](src/algorithms/sorting/radix-sort)
+- **Drzewa**
+ - `B` [Przeszukiwanie w głąb](src/algorithms/tree/depth-first-search) (DFS)
+ - `B` [Przeszukiwanie wszerz](src/algorithms/tree/breadth-first-search) (BFS)
+- **Grafy**
+ - `B` [Przeszukiwanie w głąb](src/algorithms/graph/depth-first-search) (DFS)
+ - `B` [Przeszukiwanie wszerz](src/algorithms/graph/breadth-first-search) (BFS)
+ - `B` [Algorytm Kruskala](src/algorithms/graph/kruskal) - znalezienie Minimalnego Drzewa Opinającego (MST) dla ważonego nieukierunkowanego wykresu
+ - `A` [Algorytm Dijkstry](src/algorithms/graph/dijkstra) - znajdowanie najkrótszej ścieżki z pojedynczego źródła w grafie
+ - `A` [Algorytm Bellmana-Forda](src/algorithms/graph/bellman-ford) - znajdowanie najkrótszych ścieżek do wszystkich wierzchołków wykresu z jednego wierzchołka
+ - `A` [Algorytm Floyd-Warshalla](src/algorithms/graph/floyd-warshall) - znajdź najkrótsze ścieżki między wszystkimi parami wierzchołków
+ - `A` [Detect Cycle](src/algorithms/graph/detect-cycle) - zarówno dla wykresów skierowanych, jak i nieukierunkowanych(wersje oparte na DFS i Rozłączny Zestaw)
+ - `A` [Algorytm Prima](src/algorithms/graph/prim) - znalezienie Minimalnego Drzewa Opinającego (MST) dla ważonego nieukierunkowanego wykresu
+ - `A` [Sortowanie Topologiczne](src/algorithms/graph/topological-sorting) - metoda DFS
+ - `A` [Punkty Artykulacji](src/algorithms/graph/articulation-points) - Algorytm Tarjana (oparty o DFS)
+ - `A` [Mosty](src/algorithms/graph/bridges) - Oparty na algorytmie DFS
+ - `A` [Ścieżka Euleriana i Obwód Euleriana](src/algorithms/graph/eulerian-path) - Algorytm Fleurya - Odwiedź każdą krawędź dokładnie raz
+ - `A` [Cykl Hamiltoniana](src/algorithms/graph/hamiltonian-cycle) - Odwiedź każdy wierzchołek dokładnie raz
+ - `A` [Silnie Połączone Komponenty](src/algorithms/graph/strongly-connected-components) - Algorytm Kosaraja
+ - `A` [Travelling Salesman Problem](src/algorithms/graph/travelling-salesman) - najkrótsza ścieżka która odwiedza każde miasto i wraca miasta początkującego
+- **Niezkategorizowane**
+ - `B` [Wieża Hanoi](src/algorithms/uncategorized/hanoi-tower)
+ - `B` [Kwadratowa Matryca Obrotu](src/algorithms/uncategorized/square-matrix-rotation) - algorytm w miejscu
+ - `B` [Jump Game](src/algorithms/uncategorized/jump-game) - cofanie, dynamiczne programowanie (od góry do dołu + od dołu do góry) i przykłady chciwego
+ - `B` [Unikatowe Ścieżki](src/algorithms/uncategorized/unique-paths) - cofanie, dynamiczne programowanie i przykłady oparte na Trójkącie Pascala
+ - `A` [Problem N-Queens](src/algorithms/uncategorized/n-queens)
+ - `A` [Knight's Tour](src/algorithms/uncategorized/knight-tour)
### Algorytmy według paradygmatu
-Paradygmat algorytmiczny jest ogólną metodą lub podejściem, które jest
-podstawą projektowania klasy algorytmów. Jest abstrakcją wyższą niż
-pojęcie algorytmu, podobnie jak algorytm jest abstrakcją wyższą niż
+Paradygmat algorytmiczny jest ogólną metodą lub podejściem, które jest
+podstawą projektowania klasy algorytmów. Jest abstrakcją wyższą niż
+pojęcie algorytmu, podobnie jak algorytm jest abstrakcją wyższą niż
program komputerowy.
-* **Metoda Siłowa** - Sprawdza wszystkie możliwosci i wybiera najlepsze rozwiązanie.
- * `B` [Wyszukiwanie Liniowe](src/algorithms/search/linear-search)
- * `A` [Maksymalna Podtablica](src/algorithms/sets/maximum-subarray)
- * `A` [Problem z Podróżującym Sprzedawcą](src/algorithms/graph/travelling-salesman) - najkrótsza możliwa trasa, która odwiedza każde miasto i wraca do miasta początkowego
-* **Chciwy** - wybierz najlepszą opcję w obecnym czasie, bez względu na przyszłość
- * `B` [Jump Game](src/algorithms/uncategorized/jump-game)
- * `A` [Niezwiązany Problem Knapsacka ](src/algorithms/sets/knapsack-problem)
- * `A` [Algorytm Dijkstry](src/algorithms/graph/dijkstra) -
-znalezienie najkrótszej ścieżki do wszystkich wierzchołków grafu
- * `A` [Algorytm Prima](src/algorithms/graph/prim) - znalezienie Minimalnego Drzewa Opinającego (MST) dla ważonego nieukierunkowanego wykresu
- * `A` [Algorytm Kruskala](src/algorithms/graph/kruskal) - znalezienie Minimalnego Drzewa Opinającego (MST) dla ważonego nieukierunkowanego wykresu
-* **Dziel i Zwyciężaj** - podziel problem na mniejsze części, a następnie rozwiąż te części
- * `B` [Wyszukiwanie Binarne](src/algorithms/search/binary-search)
- * `B` [Wieża Hanoi](src/algorithms/uncategorized/hanoi-tower)
- * `B` [Trójkąt Pascala](src/algorithms/math/pascal-triangle)
- * `B` [Algorytm Euclideana](src/algorithms/math/euclidean-algorithm) - obliczyć Największy Wspólny Dzielnik(GCD)
- * `B` [Sortowanie przez scalanie](src/algorithms/sorting/merge-sort)
- * `B` [Szybkie Sortowanie](src/algorithms/sorting/quick-sort)
- * `B` [Drzewo Przeszukiwania W Głąb](src/algorithms/tree/depth-first-search) (DFS)
- * `B` [Graf Przeszukiwania W Głąb](src/algorithms/graph/depth-first-search) (DFS)
- * `B` [Jump Game](src/algorithms/uncategorized/jump-game)
- * `A` [Permutacje](src/algorithms/sets/permutations) (z albo bez powtórzeń)
- * `A` [Kombinacje](src/algorithms/sets/combinations) (z albo bez powtórzeń)
-* **Programowanie Dynamiczne** - zbuduj rozwiązanie, korzystając z wcześniej znalezionych podrzędnych rozwiązań
- * `B` [Ciąg Fibonacciego](src/algorithms/math/fibonacci)
- * `B` [Jump Game](src/algorithms/uncategorized/jump-game)
- * `B` [Unikatowe Scieżki](src/algorithms/uncategorized/unique-paths)
- * `A` [Dystans Levenshteina](src/algorithms/string/levenshtein-distance) - minimalna odległość edycji między dwiema sekwencjami
- * `A` [Najdłuższa Wspólna Podsekwencja](src/algorithms/sets/longest-common-subsequence) (LCS)
- * `A` [Najdłuższa Wspólna Podłańcucha](src/algorithms/string/longest-common-substring)
- * `A` [Najdłuższa Wzrostająca Podsekwencja](src/algorithms/sets/longest-increasing-subsequence)
- * `A` [Najkrótsza Wspólna Supersekwencja](src/algorithms/sets/shortest-common-supersequence)
- * `A` [0/1 Problem Knapsacka](src/algorithms/sets/knapsack-problem)
- * `A` [Partycja Całkowita](src/algorithms/math/integer-partition)
- * `A` [Maksymalne Podtablice](src/algorithms/sets/maximum-subarray)
- * `A` [Algorytm Bellman-Forda](src/algorithms/graph/bellman-ford) - znalezienie najkrótszej ścieżki wszystkich wierzchołków wykresu
- * `A` [Algorytm Floyd-Warshalla](src/algorithms/graph/floyd-warshall) -
-znajdź najkrótsze ścieżki między wszystkimi parami wierzchołków
- * `A` [Dopasowanie Wyrażeń Regularnych](src/algorithms/string/regular-expression-matching)
-* **Algorytm z nawrotami** - podobny do metody siłowej, próbuje wygenerować wszystkie możliwe rozwiązania, jednak za każdym razem generujesz następne rozwiązanie które testujesz
-jeżeli zaspokaja wszystkie warunki, tylko wtedy generuje kolejne rozwiązania. W innym wypadku, cofa sie, i podąża inna ścieżka znaleźenia rozwiązania. Zazwyczaj, używane jest przejście przez Przeszukiwania W Głąb(DFS) przestrzeni stanów.
- * `B` [Jump Game](src/algorithms/uncategorized/jump-game)
- * `B` [Unikatowe Scieżki](src/algorithms/uncategorized/unique-paths)
- * `A` [Cykl Hamiltoniana](src/algorithms/graph/hamiltonian-cycle) - Odwiedź każdy wierzchołek dokładnie raz
- * `A` [Problem N-Queens](src/algorithms/uncategorized/n-queens)
- * `A` [Knight's Tour](src/algorithms/uncategorized/knight-tour)
- * `A` [Zestaw Sumy](src/algorithms/sets/combination-sum) - znajduje wszystkie zestawy które tworzą określoną sumę
-* **Metoda Podziału i Ograniczeń** - Pamięta o niskonakładowym rozwiązaniu znalezionym na każdym etapie szukania nawrotu,
-używa kosztu niskonakładowego kosztu, które dotychczas zostało znalezione jako niska granica najmniejszego kosztu
-do rozwiązanie problemu, aby odrzucić cząstkowe rozwiązania o kosztach większych niż niskonakładowe
-rozwiązanie znalezione do tej pory.
-Zazwyczan trajektoria BFS, w połączeniu z trajektorią Przeszukiwania W Głąb (DFS) drzewa przestrzeni stanów jest użyte.
+- **Metoda Siłowa** - Sprawdza wszystkie możliwosci i wybiera najlepsze rozwiązanie.
+ - `B` [Wyszukiwanie Liniowe](src/algorithms/search/linear-search)
+ - `A` [Maksymalna Podtablica](src/algorithms/sets/maximum-subarray)
+ - `A` [Problem z Podróżującym Sprzedawcą](src/algorithms/graph/travelling-salesman) - najkrótsza możliwa trasa, która odwiedza każde miasto i wraca do miasta początkowego
+- **Chciwy** - wybierz najlepszą opcję w obecnym czasie, bez względu na przyszłość
+ - `B` [Jump Game](src/algorithms/uncategorized/jump-game)
+ - `A` [Niezwiązany Problem Knapsacka ](src/algorithms/sets/knapsack-problem)
+ - `A` [Algorytm Dijkstry](src/algorithms/graph/dijkstra) -
+ znalezienie najkrótszej ścieżki do wszystkich wierzchołków grafu
+ - `A` [Algorytm Prima](src/algorithms/graph/prim) - znalezienie Minimalnego Drzewa Opinającego (MST) dla ważonego nieukierunkowanego wykresu
+ - `A` [Algorytm Kruskala](src/algorithms/graph/kruskal) - znalezienie Minimalnego Drzewa Opinającego (MST) dla ważonego nieukierunkowanego wykresu
+- **Dziel i Zwyciężaj** - podziel problem na mniejsze części, a następnie rozwiąż te części
+ - `B` [Wyszukiwanie Binarne](src/algorithms/search/binary-search)
+ - `B` [Wieża Hanoi](src/algorithms/uncategorized/hanoi-tower)
+ - `B` [Trójkąt Pascala](src/algorithms/math/pascal-triangle)
+ - `B` [Algorytm Euclideana](src/algorithms/math/euclidean-algorithm) - obliczyć Największy Wspólny Dzielnik(GCD)
+ - `B` [Sortowanie przez scalanie](src/algorithms/sorting/merge-sort)
+ - `B` [Szybkie Sortowanie](src/algorithms/sorting/quick-sort)
+ - `B` [Drzewo Przeszukiwania W Głąb](src/algorithms/tree/depth-first-search) (DFS)
+ - `B` [Graf Przeszukiwania W Głąb](src/algorithms/graph/depth-first-search) (DFS)
+ - `B` [Jump Game](src/algorithms/uncategorized/jump-game)
+ - `A` [Permutacje](src/algorithms/sets/permutations) (z albo bez powtórzeń)
+ - `A` [Kombinacje](src/algorithms/sets/combinations) (z albo bez powtórzeń)
+- **Programowanie Dynamiczne** - zbuduj rozwiązanie, korzystając z wcześniej znalezionych podrzędnych rozwiązań
+ - `B` [Ciąg Fibonacciego](src/algorithms/math/fibonacci)
+ - `B` [Jump Game](src/algorithms/uncategorized/jump-game)
+ - `B` [Unikatowe Scieżki](src/algorithms/uncategorized/unique-paths)
+ - `A` [Dystans Levenshteina](src/algorithms/string/levenshtein-distance) - minimalna odległość edycji między dwiema sekwencjami
+ - `A` [Najdłuższa Wspólna Podsekwencja](src/algorithms/sets/longest-common-subsequence) (LCS)
+ - `A` [Najdłuższa Wspólna Podłańcucha](src/algorithms/string/longest-common-substring)
+ - `A` [Najdłuższa Wzrostająca Podsekwencja](src/algorithms/sets/longest-increasing-subsequence)
+ - `A` [Najkrótsza Wspólna Supersekwencja](src/algorithms/sets/shortest-common-supersequence)
+ - `A` [0/1 Problem Knapsacka](src/algorithms/sets/knapsack-problem)
+ - `A` [Partycja Całkowita](src/algorithms/math/integer-partition)
+ - `A` [Maksymalne Podtablice](src/algorithms/sets/maximum-subarray)
+ - `A` [Algorytm Bellman-Forda](src/algorithms/graph/bellman-ford) - znalezienie najkrótszej ścieżki wszystkich wierzchołków wykresu
+ - `A` [Algorytm Floyd-Warshalla](src/algorithms/graph/floyd-warshall) -
+ znajdź najkrótsze ścieżki między wszystkimi parami wierzchołków
+ - `A` [Dopasowanie Wyrażeń Regularnych](src/algorithms/string/regular-expression-matching)
+- **Algorytm z nawrotami** - podobny do metody siłowej, próbuje wygenerować wszystkie możliwe rozwiązania, jednak za każdym razem generujesz następne rozwiązanie które testujesz
+ jeżeli zaspokaja wszystkie warunki, tylko wtedy generuje kolejne rozwiązania. W innym wypadku, cofa sie, i podąża inna ścieżka znaleźenia rozwiązania. Zazwyczaj, używane jest przejście przez Przeszukiwania W Głąb(DFS) przestrzeni stanów.
+ - `B` [Jump Game](src/algorithms/uncategorized/jump-game)
+ - `B` [Unikatowe Scieżki](src/algorithms/uncategorized/unique-paths)
+ - `A` [Cykl Hamiltoniana](src/algorithms/graph/hamiltonian-cycle) - Odwiedź każdy wierzchołek dokładnie raz
+ - `A` [Problem N-Queens](src/algorithms/uncategorized/n-queens)
+ - `A` [Knight's Tour](src/algorithms/uncategorized/knight-tour)
+ - `A` [Zestaw Sumy](src/algorithms/sets/combination-sum) - znajduje wszystkie zestawy które tworzą określoną sumę
+- **Metoda Podziału i Ograniczeń** - Pamięta o niskonakładowym rozwiązaniu znalezionym na każdym etapie szukania nawrotu,
+ używa kosztu niskonakładowego kosztu, które dotychczas zostało znalezione jako niska granica najmniejszego kosztu
+ do rozwiązanie problemu, aby odrzucić cząstkowe rozwiązania o kosztach większych niż niskonakładowe
+ rozwiązanie znalezione do tej pory.
+ Zazwyczan trajektoria BFS, w połączeniu z trajektorią Przeszukiwania W Głąb (DFS) drzewa przestrzeni stanów jest użyte.
## Jak używać repozytorium
**Zainstaluj wszystkie zależnosci**
+
```
npm install
```
@@ -208,11 +210,13 @@ npm run lint
```
**Uruchom wszystkie testy**
+
```
npm test
```
**Uruchom testy używając określonej nazwy**
+
```
npm test -- 'LinkedList'
```
@@ -222,7 +226,7 @@ npm test -- 'LinkedList'
Możesz pociwiczyć ze strukturą danych i algorytmami w `./src/playground/playground.js` zakartotekuj i napisz
testy do tego w `./src/playground/__test__/playground.test.js`.
-Następnie uruchom następującą komendę w celu przetestowania czy twoje kod działa według oczekiwań:
+Następnie uruchom następującą komendę w celu przetestowania czy twoje kod działa według oczekiwań:
```
npm test -- 'playground'
@@ -236,7 +240,7 @@ npm test -- 'playground'
### Big O Notacja
-Kolejność wzrastania algorytmów według Big O notacji.
+Kolejność wzrastania algorytmów według Big O notacji.

@@ -244,41 +248,41 @@ Kolejność wzrastania algorytmów według Big O notacji.
Poniżej umieszczamy listę najbardziej używanych Big O notacji i ich porównania wydajności do róznych rozmiarów z wprowadzonych danych.
-| Big O notacja | Obliczenia na 10 elementów | Obliczenia na 100 elementów | Obliczenia na 1000 elementów |
-| -------------- | ---------------------------- | ----------------------------- | ------------------------------- |
-| **O(1)** | 1 | 1 | 1 |
-| **O(log N)** | 3 | 6 | 9 |
-| **O(N)** | 10 | 100 | 1000 |
-| **O(N log N)** | 30 | 600 | 9000 |
-| **O(N^2)** | 100 | 10000 | 1000000 |
-| **O(2^N)** | 1024 | 1.26e+29 | 1.07e+301 |
-| **O(N!)** | 3628800 | 9.3e+157 | 4.02e+2567 |
+| Big O notacja | Obliczenia na 10 elementów | Obliczenia na 100 elementów | Obliczenia na 1000 elementów |
+| -------------- | -------------------------- | --------------------------- | ---------------------------- |
+| **O(1)** | 1 | 1 | 1 |
+| **O(log N)** | 3 | 6 | 9 |
+| **O(N)** | 10 | 100 | 1000 |
+| **O(N log N)** | 30 | 600 | 9000 |
+| **O(N^2)** | 100 | 10000 | 1000000 |
+| **O(2^N)** | 1024 | 1.26e+29 | 1.07e+301 |
+| **O(N!)** | 3628800 | 9.3e+157 | 4.02e+2567 |
### Złożoność operacji struktury danych
-| Struktura Danych | Dostęp | Szukaj | Umieszczanie | Usuwanie | Komentarze |
-| ------------------------------- | :-------: | :-------: | :----------: | :-------: | :----------- |
-| **Szereg** | 1 | n | n | n | |
-| **Sterta** | n | n | 1 | 1 | |
-| **Kolejka** | n | n | 1 | 1 | |
-| **Lista Powiązana** | n | n | 1 | 1 | |
-| **Tablica funkcji mieszanej** | - | n | n | n | W wypadku idealnej funkcji skrótu koszt mógłby sie równać O(1) |
-| **Binarne Drzewo Poszukiwań** | n | n | n | n | W przypadku zrównoważonych kosztów drzew byłoby O(log(n)) |
-| **B-Drzewo** | log(n) | log(n) | log(n) | log(n) | |
-| **Drzewa czerwono-czarne** | log(n) | log(n) | log(n) | log(n) | |
-| **AVL Drzewo** | log(n) | log(n) | log(n) | log(n) | |
-| **Filtr Blooma** | - | 1 | 1 | - | Fałszywe dotatnie są możliwe podczas wyszukiwania |
+| Struktura Danych | Dostęp | Szukaj | Umieszczanie | Usuwanie | Komentarze |
+| ----------------------------- | :----: | :----: | :----------: | :------: | :------------------------------------------------------------- |
+| **Szereg** | 1 | n | n | n | |
+| **Sterta** | n | n | 1 | 1 | |
+| **Kolejka** | n | n | 1 | 1 | |
+| **Lista Powiązana** | n | n | 1 | 1 | |
+| **Tablica funkcji mieszanej** | - | n | n | n | W wypadku idealnej funkcji skrótu koszt mógłby sie równać O(1) |
+| **Binarne Drzewo Poszukiwań** | n | n | n | n | W przypadku zrównoważonych kosztów drzew byłoby O(log(n)) |
+| **B-Drzewo** | log(n) | log(n) | log(n) | log(n) | |
+| **Drzewa czerwono-czarne** | log(n) | log(n) | log(n) | log(n) | |
+| **AVL Drzewo** | log(n) | log(n) | log(n) | log(n) | |
+| **Filtr Blooma** | - | 1 | 1 | - | Fałszywe dotatnie są możliwe podczas wyszukiwania |
### Sortowanie Tablic Złożoności Algorytmów
-| Nazwa | Najlepszy | Średni | Najgorszy | Pamięć | Stabilność | Komentarze |
-| ----------------------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :---------: | :---------- |
-| **Sortowanie bąbelkowe** | n | n2 | n2 | 1 | Yes | |
-| **Sortowanie przez wstawianie** | n | n2 | n2 | 1 | Yes | |
-| **Sortowanie przez wybieranie** | n2 | n2 | n2 | 1 | No | |
-| **Sortowanie przez kopcowanie** | n log(n) | n log(n) | n log(n) | 1 | No | |
-| **Sortowanie przez scalanie** | n log(n) | n log(n) | n log(n) | n | Yes | |
-| **Szybkie sortowanie** | n log(n) | n log(n) | n2 | log(n) | No | Szybkie sortowanie jest zazwyczaj robione w miejsce O(log(n)) stosu przestrzeni |
-| **Sortowanie Shella** | n log(n) | zależy od luki w układzie | n (log(n))2 | 1 | No | |
-| **Sortowanie przez zliczanie** | n + r | n + r | n + r | n + r | Yes | r - największy numer w tablicy|
-| **Sortowanie Radix** | n * k | n * k | n * k | n + k | Yes | k -długość najdłuższego klucza |
+| Nazwa | Najlepszy | Średni | Najgorszy | Pamięć | Stabilność | Komentarze |
+| ------------------------------- | :-----------: | :-----------------------: | :-------------------------: | :----: | :--------: | :------------------------------------------------------------------------------ |
+| **Sortowanie bąbelkowe** | n | n2 | n2 | 1 | Yes | |
+| **Sortowanie przez wstawianie** | n | n2 | n2 | 1 | Yes | |
+| **Sortowanie przez wybieranie** | n2 | n2 | n2 | 1 | No | |
+| **Sortowanie przez kopcowanie** | n log(n) | n log(n) | n log(n) | 1 | No | |
+| **Sortowanie przez scalanie** | n log(n) | n log(n) | n log(n) | n | Yes | |
+| **Szybkie sortowanie** | n log(n) | n log(n) | n2 | log(n) | No | Szybkie sortowanie jest zazwyczaj robione w miejsce O(log(n)) stosu przestrzeni |
+| **Sortowanie Shella** | n log(n) | zależy od luki w układzie | n (log(n))2 | 1 | No | |
+| **Sortowanie przez zliczanie** | n + r | n + r | n + r | n + r | Yes | r - największy numer w tablicy |
+| **Sortowanie Radix** | n \* k | n \* k | n \* k | n + k | Yes | k -długość najdłuższego klucza |
diff --git a/README.pt-BR.md b/README.pt-BR.md
index 6858121df1..a4d24a1e62 100644
--- a/README.pt-BR.md
+++ b/README.pt-BR.md
@@ -4,7 +4,7 @@
[](https://codecov.io/gh/trekhleb/javascript-algorithms)
Este repositório contém exemplos baseados em JavaScript de muitos
-algoritmos e estruturas de dados populares.
+algoritmos e estruturas de dados populares.
Cada algoritmo e estrutura de dado possui seu próprio README
com explicações relacionadas e links para leitura adicional (incluindo
@@ -18,7 +18,8 @@ _Leia isto em outros idiomas:_
[_日本語_](README.ja-JP.md),
[_Polski_](README.pl-PL.md),
[_Français_](README.fr-FR.md),
-[_Español_](README.es-ES.md)
+[_Español_](README.es-ES.md),
+[_Русский_](README.ru-RU.md)
## Data Structures
@@ -29,23 +30,23 @@ os dados.
`B` - Iniciante, `A` - Avançado
-* `B` [Lista Encadeada (Linked List)](src/data-structures/linked-list/README.pt-BR.md)
-* `B` [Lista Duplamente Ligada (Doubly Linked List)](src/data-structures/doubly-linked-list/README.pt-BR.md)
-* `B` [Fila (Queue)](src/data-structures/queue/README.pt-BR.md)
-* `B` [Stack](src/data-structures/stack/README.pt-BR.md)
-* `B` [Tabela de Hash (Hash Table)](src/data-structures/hash-table/README.pt-BR.md)
-* `B` [Heap](src/data-structures/heap/README.pt-BR.md)
-* `B` [Fila de Prioridade (Priority Queue)](src/data-structures/priority-queue/README.pt-BR.md)
-* `A` [Trie](src/data-structures/trie/README.pt-BR.md)
-* `A` [Árvore (Tree)](src/data-structures/tree/README.pt-BR.md)
- * `A` [Árvore de Pesquisa Binária (Binary Search Tree)](src/data-structures/tree/binary-search-tree/README.pt-BR.md)
- * `A` [Árvore AVL (AVL Tree)](src/data-structures/tree/avl-tree/README.pt-BR.md)
- * `A` [Árvore Vermelha-Preta (Red-Black Tree)](src/data-structures/tree/red-black-tree/README.pt-BR.md)
- * `A` [Árvore de Segmento (Segment Tree)](src/data-structures/tree/segment-tree/README.pt-BR.md) - com exemplos de consultas min / max / sum range
- * `A` [Árvore Fenwick (Fenwick Tree)](src/data-structures/tree/fenwick-tree/README.pt-BR.md) (Árvore indexada binária)
-* `A` [Gráfico (Graph)](src/data-structures/graph/README.pt-BR.md) (ambos dirigidos e não direcionados)
-* `A` [Conjunto Disjuntor (Disjoint Set)](src/data-structures/disjoint-set/README.pt-BR.md)
-* `A` [Filtro Bloom (Bloom Filter)](src/data-structures/bloom-filter/README.pt-BR.md)
+- `B` [Lista Encadeada (Linked List)](src/data-structures/linked-list/README.pt-BR.md)
+- `B` [Lista Duplamente Ligada (Doubly Linked List)](src/data-structures/doubly-linked-list/README.pt-BR.md)
+- `B` [Fila (Queue)](src/data-structures/queue/README.pt-BR.md)
+- `B` [Stack](src/data-structures/stack/README.pt-BR.md)
+- `B` [Tabela de Hash (Hash Table)](src/data-structures/hash-table/README.pt-BR.md)
+- `B` [Heap](src/data-structures/heap/README.pt-BR.md)
+- `B` [Fila de Prioridade (Priority Queue)](src/data-structures/priority-queue/README.pt-BR.md)
+- `A` [Trie](src/data-structures/trie/README.pt-BR.md)
+- `A` [Árvore (Tree)](src/data-structures/tree/README.pt-BR.md)
+ - `A` [Árvore de Pesquisa Binária (Binary Search Tree)](src/data-structures/tree/binary-search-tree/README.pt-BR.md)
+ - `A` [Árvore AVL (AVL Tree)](src/data-structures/tree/avl-tree/README.pt-BR.md)
+ - `A` [Árvore Vermelha-Preta (Red-Black Tree)](src/data-structures/tree/red-black-tree/README.pt-BR.md)
+ - `A` [Árvore de Segmento (Segment Tree)](src/data-structures/tree/segment-tree/README.pt-BR.md) - com exemplos de consultas min / max / sum range
+ - `A` [Árvore Fenwick (Fenwick Tree)](src/data-structures/tree/fenwick-tree/README.pt-BR.md) (Árvore indexada binária)
+- `A` [Gráfico (Graph)](src/data-structures/graph/README.pt-BR.md) (ambos dirigidos e não direcionados)
+- `A` [Conjunto Disjuntor (Disjoint Set)](src/data-structures/disjoint-set/README.pt-BR.md)
+- `A` [Filtro Bloom (Bloom Filter)](src/data-structures/bloom-filter/README.pt-BR.md)
## Algoritmos
@@ -56,83 +57,83 @@ um conjunto de regras que define precisamente uma sequência de operações.
### Algoritmos por Tópico
-* **Matemática**
- * `B` [Manipulação Bit](src/algorithms/math/bits) - set/get/update/clear bits, multiplicação / divisão por dois, tornar negativo etc.
- * `B` [Fatorial](src/algorithms/math/factorial)
- * `B` [Número de Fibonacci](src/algorithms/math/fibonacci)
- * `B` [Teste de Primalidade](src/algorithms/math/primality-test) (método de divisão experimental)
- * `B` [Algoritmo Euclidiano](src/algorithms/math/euclidean-algorithm) - calcular o maior divisor comum (GCD)
- * `B` [Mínimo múltiplo comum](src/algorithms/math/least-common-multiple) (LCM)
- * `B` [Peneira de Eratóstenes](src/algorithms/math/sieve-of-eratosthenes) - encontrar todos os números primos até um determinado limite
- * `B` [Potência de dois](src/algorithms/math/is-power-of-two) - verifique se o número é a potência de dois (algoritmos ingênuos e bit a bit)
- * `B` [Triângulo de Pascal](src/algorithms/math/pascal-triangle)
- * `B` [Número complexo](src/algorithms/math/complex-number) - números complexos e operações básicas com eles
- * `A` [Partição inteira](src/algorithms/math/integer-partition)
- * `A` [Algoritmo Liu Hui π](src/algorithms/math/liu-hui) - cálculos aproximados de π baseados em N-gons
-* **Conjuntos**
- * `B` [Produto cartesiano](src/algorithms/sets/cartesian-product) - produto de vários conjuntos
- * `B` [Permutações de Fisher–Yates](src/algorithms/sets/fisher-yates) - permutação aleatória de uma sequência finita
- * `A` [Potência e Conjunto](src/algorithms/sets/power-set) - todos os subconjuntos de um conjunto
- * `A` [Permutações](src/algorithms/sets/permutations) (com e sem repetições)
- * `A` [Combinações](src/algorithms/sets/combinations) (com e sem repetições)
- * `A` [Mais longa subsequência comum](src/algorithms/sets/longest-common-subsequence) (LCS)
- * `A` [Maior subsequência crescente](src/algorithms/sets/longest-increasing-subsequence)
- * `A` [Supersequência Comum mais curta](src/algorithms/sets/shortest-common-supersequence) (SCS)
- * `A` [Problema da mochila](src/algorithms/sets/knapsack-problem) - "0/1" e "Não consolidado"
- * `A` [Máximo Subarray](src/algorithms/sets/maximum-subarray) - "Força bruta" e " Programação Dinâmica" versões (Kadane's)
- * `A` [Soma de Combinação](src/algorithms/sets/combination-sum) - encontre todas as combinações que formam uma soma específica
-* **Cadeia de Caracteres**
- * `B` [Hamming Distance](src/algorithms/string/hamming-distance) - número de posições em que os símbolos são diferentes
- * `A` [Levenshtein Distance](src/algorithms/string/levenshtein-distance) - distância mínima de edição entre duas sequências
- * `A` [Knuth–Morris–Pratt Algorithm](src/algorithms/string/knuth-morris-pratt) (Algoritmo KMP) - pesquisa de substring (correspondência de padrão)
- * `A` [Z Algorithm](src/algorithms/string/z-algorithm) - pesquisa de substring (correspondência de padrão)
- * `A` [Rabin Karp Algorithm](src/algorithms/string/rabin-karp) - pesquisa de substring
- * `A` [Longest Common Substring](src/algorithms/string/longest-common-substring)
- * `A` [Regular Expression Matching](src/algorithms/string/regular-expression-matching)
-* **Buscas**
- * `B` [Linear Search](src/algorithms/search/linear-search)
- * `B` [Jump Search](src/algorithms/search/jump-search) (ou Bloquear pesquisa) - pesquisar na matriz ordenada
- * `B` [Binary Search](src/algorithms/search/binary-search) - pesquisar na matriz ordenada
- * `B` [Interpolation Search](src/algorithms/search/interpolation-search) - pesquisar em matriz classificada uniformemente distribuída
-* **Classificação**
- * `B` [Bubble Sort](src/algorithms/sorting/bubble-sort)
- * `B` [Selection Sort](src/algorithms/sorting/selection-sort)
- * `B` [Insertion Sort](src/algorithms/sorting/insertion-sort)
- * `B` [Heap Sort](src/algorithms/sorting/heap-sort)
- * `B` [Merge Sort](src/algorithms/sorting/merge-sort)
- * `B` [Quicksort](src/algorithms/sorting/quick-sort) - implementações local e não local
- * `B` [Shellsort](src/algorithms/sorting/shell-sort)
- * `B` [Counting Sort](src/algorithms/sorting/counting-sort)
- * `B` [Radix Sort](src/algorithms/sorting/radix-sort)
-* **Arvóres**
- * `B` [Depth-First Search](src/algorithms/tree/depth-first-search) (DFS)
- * `B` [Breadth-First Search](src/algorithms/tree/breadth-first-search) (BFS)
-* **Gráficos**
- * `B` [Depth-First Search](src/algorithms/graph/depth-first-search) (DFS)
- * `B` [Breadth-First Search](src/algorithms/graph/breadth-first-search) (BFS)
- * `B` [Kruskal’s Algorithm](src/algorithms/graph/kruskal) - encontrando Árvore Mínima de Abrangência (MST) para grafo não direcionado ponderado
- * `A` [Dijkstra Algorithm](src/algorithms/graph/dijkstra) - encontrar caminhos mais curtos para todos os vértices do grafo a partir de um único vértice
- * `A` [Bellman-Ford Algorithm](src/algorithms/graph/bellman-ford) - encontrar caminhos mais curtos para todos os vértices do grafo a partir de um único vértice
- * `A` [Floyd-Warshall Algorithm](src/algorithms/graph/floyd-warshall) - encontrar caminhos mais curtos entre todos os pares de vértices
- * `A` [Detect Cycle](src/algorithms/graph/detect-cycle) - para gráficos direcionados e não direcionados (versões baseadas em DFS e Conjunto Disjuntivo)
- * `A` [Prim’s Algorithm](src/algorithms/graph/prim) - encontrando Árvore Mínima de Abrangência (MST) para grafo não direcionado ponderado
- * `A` [Topological Sorting](src/algorithms/graph/topological-sorting) - Métodos DFS
- * `A` [Articulation Points](src/algorithms/graph/articulation-points) -O algoritmo de Tarjan (baseado em DFS)
- * `A` [Bridges](src/algorithms/graph/bridges) - Algoritmo baseado em DFS
- * `A` [Eulerian Path and Eulerian Circuit](src/algorithms/graph/eulerian-path) - Algoritmo de Fleury - Visite todas as bordas exatamente uma vez
- * `A` [Hamiltonian Cycle](src/algorithms/graph/hamiltonian-cycle) - Visite todas as bordas exatamente uma vez
- * `A` [Strongly Connected Components](src/algorithms/graph/strongly-connected-components) - Algoritmo de Kosaraju's
- * `A` [Travelling Salesman Problem](src/algorithms/graph/travelling-salesman) - rota mais curta possível que visita cada cidade e retorna à cidade de origem
-* **criptografia**
- * `B` [Polynomial Hash](src/algorithms/cryptography/polynomial-hash) - função de hash de rolagem baseada em polinômio
-* **Sem categoria**
- * `B` [Tower of Hanoi](src/algorithms/uncategorized/hanoi-tower)
- * `B` [Square Matrix Rotation](src/algorithms/uncategorized/square-matrix-rotation) - algoritmo no local
- * `B` [Jump Game](src/algorithms/uncategorized/jump-game) - backtracking, programação dinâmica (top-down + bottom-up) e exemplos gananciosos
- * `B` [Unique Paths](src/algorithms/uncategorized/unique-paths) - backtracking, programação dinâmica e exemplos baseados no triângulo de Pascal
- * `B` [Rain Terraces](src/algorithms/uncategorized/rain-terraces) - trapping problema da água da chuva (programação dinâmica e versões de força bruta)
- * `A` [N-Queens Problem](src/algorithms/uncategorized/n-queens)
- * `A` [Knight's Tour](src/algorithms/uncategorized/knight-tour)
+- **Matemática**
+ - `B` [Manipulação Bit](src/algorithms/math/bits) - set/get/update/clear bits, multiplicação / divisão por dois, tornar negativo etc.
+ - `B` [Fatorial](src/algorithms/math/factorial)
+ - `B` [Número de Fibonacci](src/algorithms/math/fibonacci)
+ - `B` [Teste de Primalidade](src/algorithms/math/primality-test) (método de divisão experimental)
+ - `B` [Algoritmo Euclidiano](src/algorithms/math/euclidean-algorithm) - calcular o maior divisor comum (GCD)
+ - `B` [Mínimo múltiplo comum](src/algorithms/math/least-common-multiple) (LCM)
+ - `B` [Peneira de Eratóstenes](src/algorithms/math/sieve-of-eratosthenes) - encontrar todos os números primos até um determinado limite
+ - `B` [Potência de dois](src/algorithms/math/is-power-of-two) - verifique se o número é a potência de dois (algoritmos ingênuos e bit a bit)
+ - `B` [Triângulo de Pascal](src/algorithms/math/pascal-triangle)
+ - `B` [Número complexo](src/algorithms/math/complex-number) - números complexos e operações básicas com eles
+ - `A` [Partição inteira](src/algorithms/math/integer-partition)
+ - `A` [Algoritmo Liu Hui π](src/algorithms/math/liu-hui) - cálculos aproximados de π baseados em N-gons
+- **Conjuntos**
+ - `B` [Produto cartesiano](src/algorithms/sets/cartesian-product) - produto de vários conjuntos
+ - `B` [Permutações de Fisher–Yates](src/algorithms/sets/fisher-yates) - permutação aleatória de uma sequência finita
+ - `A` [Potência e Conjunto](src/algorithms/sets/power-set) - todos os subconjuntos de um conjunto
+ - `A` [Permutações](src/algorithms/sets/permutations) (com e sem repetições)
+ - `A` [Combinações](src/algorithms/sets/combinations) (com e sem repetições)
+ - `A` [Mais longa subsequência comum](src/algorithms/sets/longest-common-subsequence) (LCS)
+ - `A` [Maior subsequência crescente](src/algorithms/sets/longest-increasing-subsequence)
+ - `A` [Supersequência Comum mais curta](src/algorithms/sets/shortest-common-supersequence) (SCS)
+ - `A` [Problema da mochila](src/algorithms/sets/knapsack-problem) - "0/1" e "Não consolidado"
+ - `A` [Máximo Subarray](src/algorithms/sets/maximum-subarray) - "Força bruta" e " Programação Dinâmica" versões (Kadane's)
+ - `A` [Soma de Combinação](src/algorithms/sets/combination-sum) - encontre todas as combinações que formam uma soma específica
+- **Cadeia de Caracteres**
+ - `B` [Hamming Distance](src/algorithms/string/hamming-distance) - número de posições em que os símbolos são diferentes
+ - `A` [Levenshtein Distance](src/algorithms/string/levenshtein-distance) - distância mínima de edição entre duas sequências
+ - `A` [Knuth–Morris–Pratt Algorithm](src/algorithms/string/knuth-morris-pratt) (Algoritmo KMP) - pesquisa de substring (correspondência de padrão)
+ - `A` [Z Algorithm](src/algorithms/string/z-algorithm) - pesquisa de substring (correspondência de padrão)
+ - `A` [Rabin Karp Algorithm](src/algorithms/string/rabin-karp) - pesquisa de substring
+ - `A` [Longest Common Substring](src/algorithms/string/longest-common-substring)
+ - `A` [Regular Expression Matching](src/algorithms/string/regular-expression-matching)
+- **Buscas**
+ - `B` [Linear Search](src/algorithms/search/linear-search)
+ - `B` [Jump Search](src/algorithms/search/jump-search) (ou Bloquear pesquisa) - pesquisar na matriz ordenada
+ - `B` [Binary Search](src/algorithms/search/binary-search) - pesquisar na matriz ordenada
+ - `B` [Interpolation Search](src/algorithms/search/interpolation-search) - pesquisar em matriz classificada uniformemente distribuída
+- **Classificação**
+ - `B` [Bubble Sort](src/algorithms/sorting/bubble-sort)
+ - `B` [Selection Sort](src/algorithms/sorting/selection-sort)
+ - `B` [Insertion Sort](src/algorithms/sorting/insertion-sort)
+ - `B` [Heap Sort](src/algorithms/sorting/heap-sort)
+ - `B` [Merge Sort](src/algorithms/sorting/merge-sort)
+ - `B` [Quicksort](src/algorithms/sorting/quick-sort) - implementações local e não local
+ - `B` [Shellsort](src/algorithms/sorting/shell-sort)
+ - `B` [Counting Sort](src/algorithms/sorting/counting-sort)
+ - `B` [Radix Sort](src/algorithms/sorting/radix-sort)
+- **Arvóres**
+ - `B` [Depth-First Search](src/algorithms/tree/depth-first-search) (DFS)
+ - `B` [Breadth-First Search](src/algorithms/tree/breadth-first-search) (BFS)
+- **Gráficos**
+ - `B` [Depth-First Search](src/algorithms/graph/depth-first-search) (DFS)
+ - `B` [Breadth-First Search](src/algorithms/graph/breadth-first-search) (BFS)
+ - `B` [Kruskal’s Algorithm](src/algorithms/graph/kruskal) - encontrando Árvore Mínima de Abrangência (MST) para grafo não direcionado ponderado
+ - `A` [Dijkstra Algorithm](src/algorithms/graph/dijkstra) - encontrar caminhos mais curtos para todos os vértices do grafo a partir de um único vértice
+ - `A` [Bellman-Ford Algorithm](src/algorithms/graph/bellman-ford) - encontrar caminhos mais curtos para todos os vértices do grafo a partir de um único vértice
+ - `A` [Floyd-Warshall Algorithm](src/algorithms/graph/floyd-warshall) - encontrar caminhos mais curtos entre todos os pares de vértices
+ - `A` [Detect Cycle](src/algorithms/graph/detect-cycle) - para gráficos direcionados e não direcionados (versões baseadas em DFS e Conjunto Disjuntivo)
+ - `A` [Prim’s Algorithm](src/algorithms/graph/prim) - encontrando Árvore Mínima de Abrangência (MST) para grafo não direcionado ponderado
+ - `A` [Topological Sorting](src/algorithms/graph/topological-sorting) - Métodos DFS
+ - `A` [Articulation Points](src/algorithms/graph/articulation-points) -O algoritmo de Tarjan (baseado em DFS)
+ - `A` [Bridges](src/algorithms/graph/bridges) - Algoritmo baseado em DFS
+ - `A` [Eulerian Path and Eulerian Circuit](src/algorithms/graph/eulerian-path) - Algoritmo de Fleury - Visite todas as bordas exatamente uma vez
+ - `A` [Hamiltonian Cycle](src/algorithms/graph/hamiltonian-cycle) - Visite todas as bordas exatamente uma vez
+ - `A` [Strongly Connected Components](src/algorithms/graph/strongly-connected-components) - Algoritmo de Kosaraju's
+ - `A` [Travelling Salesman Problem](src/algorithms/graph/travelling-salesman) - rota mais curta possível que visita cada cidade e retorna à cidade de origem
+- **criptografia**
+ - `B` [Polynomial Hash](src/algorithms/cryptography/polynomial-hash) - função de hash de rolagem baseada em polinômio
+- **Sem categoria**
+ - `B` [Tower of Hanoi](src/algorithms/uncategorized/hanoi-tower)
+ - `B` [Square Matrix Rotation](src/algorithms/uncategorized/square-matrix-rotation) - algoritmo no local
+ - `B` [Jump Game](src/algorithms/uncategorized/jump-game) - backtracking, programação dinâmica (top-down + bottom-up) e exemplos gananciosos
+ - `B` [Unique Paths](src/algorithms/uncategorized/unique-paths) - backtracking, programação dinâmica e exemplos baseados no triângulo de Pascal
+ - `B` [Rain Terraces](src/algorithms/uncategorized/rain-terraces) - trapping problema da água da chuva (programação dinâmica e versões de força bruta)
+ - `A` [N-Queens Problem](src/algorithms/uncategorized/n-queens)
+ - `A` [Knight's Tour](src/algorithms/uncategorized/knight-tour)
### Algoritmos por Paradigma
@@ -140,62 +141,63 @@ Um paradigma algorítmico é um método ou abordagem genérica subjacente ao des
de algoritmos. É uma abstração maior do que a noção de um algoritmo, assim como
algoritmo é uma abstração maior que um programa de computador.
-* **Força bruta** - look at all the possibilities and selects the best solution
- * `B` [Linear Search](src/algorithms/search/linear-search)
- * `B` [Rain Terraces](src/algorithms/uncategorized/rain-terraces) - trapping problema da água da chuva
- * `A` [Maximum Subarray](src/algorithms/sets/maximum-subarray)
- * `A` [Travelling Salesman Problem](src/algorithms/graph/travelling-salesman) - rota mais curta possível que visita cada cidade e retorna à cidade de origem
-* **Greedy** - choose the best option at the current time, without any consideration for the future
- * `B` [Jump Game](src/algorithms/uncategorized/jump-game)
- * `A` [Unbound Knapsack Problem](src/algorithms/sets/knapsack-problem)
- * `A` [Dijkstra Algorithm](src/algorithms/graph/dijkstra) - finding shortest path to all graph vertices
- * `A` [Prim’s Algorithm](src/algorithms/graph/prim) - encontrando Árvore Mínima de Abrangência (MST) para grafo não direcionado ponderado
- * `A` [Kruskal’s Algorithm](src/algorithms/graph/kruskal) - encontrando Árvore Mínima de Abrangência (MST) para grafo não direcionado ponderado
-* **Divide and Conquer** - dividir o problema em partes menores e depois resolver essas partes
- * `B` [Binary Search](src/algorithms/search/binary-search)
- * `B` [Tower of Hanoi](src/algorithms/uncategorized/hanoi-tower)
- * `B` [Pascal's Triangle](src/algorithms/math/pascal-triangle)
- * `B` [Euclidean Algorithm](src/algorithms/math/euclidean-algorithm) - calculate the Greatest Common Divisor (GCD)
- * `B` [Merge Sort](src/algorithms/sorting/merge-sort)
- * `B` [Quicksort](src/algorithms/sorting/quick-sort)
- * `B` [Tree Depth-First Search](src/algorithms/tree/depth-first-search) (DFS)
- * `B` [Graph Depth-First Search](src/algorithms/graph/depth-first-search) (DFS)
- * `B` [Jump Game](src/algorithms/uncategorized/jump-game)
- * `A` [Permutations](src/algorithms/sets/permutations) (com e sem repetições)
- * `A` [Combinations](src/algorithms/sets/combinations) (com e sem repetições)
-* **Dynamic Programming** - criar uma solução usando sub-soluções encontradas anteriormente
- * `B` [Fibonacci Number](src/algorithms/math/fibonacci)
- * `B` [Jump Game](src/algorithms/uncategorized/jump-game)
- * `B` [Unique Paths](src/algorithms/uncategorized/unique-paths)
- * `B` [Rain Terraces](src/algorithms/uncategorized/rain-terraces) - trapping problema da água da chuva
- * `A` [Levenshtein Distance](src/algorithms/string/levenshtein-distance) - distância mínima de edição entre duas sequências
- * `A` [Longest Common Subsequence](src/algorithms/sets/longest-common-subsequence) (LCS)
- * `A` [Longest Common Substring](src/algorithms/string/longest-common-substring)
- * `A` [Longest Increasing Subsequence](src/algorithms/sets/longest-increasing-subsequence)
- * `A` [Shortest Common Supersequence](src/algorithms/sets/shortest-common-supersequence)
- * `A` [0/1 Knapsack Problem](src/algorithms/sets/knapsack-problem)
- * `A` [Integer Partition](src/algorithms/math/integer-partition)
- * `A` [Maximum Subarray](src/algorithms/sets/maximum-subarray)
- * `A` [Bellman-Ford Algorithm](src/algorithms/graph/bellman-ford) - encontrando o caminho mais curto para todos os vértices do gráfico
- * `A` [Floyd-Warshall Algorithm](src/algorithms/graph/floyd-warshall) - encontrar caminhos mais curtos entre todos os pares de vértices
- * `A` [Regular Expression Matching](src/algorithms/string/regular-expression-matching)
-* **Backtracking** - da mesma forma que a força bruta, tente gerar todas as soluções possíveis, mas cada vez que você gerar a próxima solução, você testará
-se satisfizer todas as condições, e só então continuar gerando soluções subseqüentes. Caso contrário, volte atrás e siga um caminho diferente para encontrar uma solução. Normalmente, a passagem DFS do espaço de estados está sendo usada.
- * `B` [Jump Game](src/algorithms/uncategorized/jump-game)
- * `B` [Unique Paths](src/algorithms/uncategorized/unique-paths)
- * `A` [Hamiltonian Cycle](src/algorithms/graph/hamiltonian-cycle) - Visite todos os vértices exatamente uma vez
- * `A` [N-Queens Problem](src/algorithms/uncategorized/n-queens)
- * `A` [Knight's Tour](src/algorithms/uncategorized/knight-tour)
- * `A` [Combination Sum](src/algorithms/sets/combination-sum) - encontre todas as combinações que formam uma soma específica
-* **Branch & Bound** - lembre-se da solução de menor custo encontrada em cada etapa do retrocesso
-pesquisar e usar o custo da solução de menor custo encontrada até o limite inferior do custo de
-solução de menor custo para o problema, a fim de descartar soluções parciais com custos maiores que o
-solução de menor custo encontrada até o momento. Normalmente, a travessia BFS em combinação com a passagem DFS do espaço de estados
-árvore está sendo usada
+- **Força bruta** - look at all the possibilities and selects the best solution
+ - `B` [Linear Search](src/algorithms/search/linear-search)
+ - `B` [Rain Terraces](src/algorithms/uncategorized/rain-terraces) - trapping problema da água da chuva
+ - `A` [Maximum Subarray](src/algorithms/sets/maximum-subarray)
+ - `A` [Travelling Salesman Problem](src/algorithms/graph/travelling-salesman) - rota mais curta possível que visita cada cidade e retorna à cidade de origem
+- **Greedy** - choose the best option at the current time, without any consideration for the future
+ - `B` [Jump Game](src/algorithms/uncategorized/jump-game)
+ - `A` [Unbound Knapsack Problem](src/algorithms/sets/knapsack-problem)
+ - `A` [Dijkstra Algorithm](src/algorithms/graph/dijkstra) - finding shortest path to all graph vertices
+ - `A` [Prim’s Algorithm](src/algorithms/graph/prim) - encontrando Árvore Mínima de Abrangência (MST) para grafo não direcionado ponderado
+ - `A` [Kruskal’s Algorithm](src/algorithms/graph/kruskal) - encontrando Árvore Mínima de Abrangência (MST) para grafo não direcionado ponderado
+- **Divide and Conquer** - dividir o problema em partes menores e depois resolver essas partes
+ - `B` [Binary Search](src/algorithms/search/binary-search)
+ - `B` [Tower of Hanoi](src/algorithms/uncategorized/hanoi-tower)
+ - `B` [Pascal's Triangle](src/algorithms/math/pascal-triangle)
+ - `B` [Euclidean Algorithm](src/algorithms/math/euclidean-algorithm) - calculate the Greatest Common Divisor (GCD)
+ - `B` [Merge Sort](src/algorithms/sorting/merge-sort)
+ - `B` [Quicksort](src/algorithms/sorting/quick-sort)
+ - `B` [Tree Depth-First Search](src/algorithms/tree/depth-first-search) (DFS)
+ - `B` [Graph Depth-First Search](src/algorithms/graph/depth-first-search) (DFS)
+ - `B` [Jump Game](src/algorithms/uncategorized/jump-game)
+ - `A` [Permutations](src/algorithms/sets/permutations) (com e sem repetições)
+ - `A` [Combinations](src/algorithms/sets/combinations) (com e sem repetições)
+- **Dynamic Programming** - criar uma solução usando sub-soluções encontradas anteriormente
+ - `B` [Fibonacci Number](src/algorithms/math/fibonacci)
+ - `B` [Jump Game](src/algorithms/uncategorized/jump-game)
+ - `B` [Unique Paths](src/algorithms/uncategorized/unique-paths)
+ - `B` [Rain Terraces](src/algorithms/uncategorized/rain-terraces) - trapping problema da água da chuva
+ - `A` [Levenshtein Distance](src/algorithms/string/levenshtein-distance) - distância mínima de edição entre duas sequências
+ - `A` [Longest Common Subsequence](src/algorithms/sets/longest-common-subsequence) (LCS)
+ - `A` [Longest Common Substring](src/algorithms/string/longest-common-substring)
+ - `A` [Longest Increasing Subsequence](src/algorithms/sets/longest-increasing-subsequence)
+ - `A` [Shortest Common Supersequence](src/algorithms/sets/shortest-common-supersequence)
+ - `A` [0/1 Knapsack Problem](src/algorithms/sets/knapsack-problem)
+ - `A` [Integer Partition](src/algorithms/math/integer-partition)
+ - `A` [Maximum Subarray](src/algorithms/sets/maximum-subarray)
+ - `A` [Bellman-Ford Algorithm](src/algorithms/graph/bellman-ford) - encontrando o caminho mais curto para todos os vértices do gráfico
+ - `A` [Floyd-Warshall Algorithm](src/algorithms/graph/floyd-warshall) - encontrar caminhos mais curtos entre todos os pares de vértices
+ - `A` [Regular Expression Matching](src/algorithms/string/regular-expression-matching)
+- **Backtracking** - da mesma forma que a força bruta, tente gerar todas as soluções possíveis, mas cada vez que você gerar a próxima solução, você testará
+ se satisfizer todas as condições, e só então continuar gerando soluções subseqüentes. Caso contrário, volte atrás e siga um caminho diferente para encontrar uma solução. Normalmente, a passagem DFS do espaço de estados está sendo usada.
+ - `B` [Jump Game](src/algorithms/uncategorized/jump-game)
+ - `B` [Unique Paths](src/algorithms/uncategorized/unique-paths)
+ - `A` [Hamiltonian Cycle](src/algorithms/graph/hamiltonian-cycle) - Visite todos os vértices exatamente uma vez
+ - `A` [N-Queens Problem](src/algorithms/uncategorized/n-queens)
+ - `A` [Knight's Tour](src/algorithms/uncategorized/knight-tour)
+ - `A` [Combination Sum](src/algorithms/sets/combination-sum) - encontre todas as combinações que formam uma soma específica
+- **Branch & Bound** - lembre-se da solução de menor custo encontrada em cada etapa do retrocesso
+ pesquisar e usar o custo da solução de menor custo encontrada até o limite inferior do custo de
+ solução de menor custo para o problema, a fim de descartar soluções parciais com custos maiores que o
+ solução de menor custo encontrada até o momento. Normalmente, a travessia BFS em combinação com a passagem DFS do espaço de estados
+ árvore está sendo usada
## Como usar este repositório
**Instalar todas as dependências**
+
```
npm install
```
@@ -209,11 +211,13 @@ npm run lint
```
**Execute todos os testes**
+
```
npm test
```
**Executar testes por nome**
+
```
npm test -- 'LinkedList'
```
@@ -245,41 +249,41 @@ Fonte: [Notação Big-O dicas](http://bigocheatsheet.com/).
Abaixo está a lista de algumas das notações Big O mais usadas e suas comparações de desempenho em relação aos diferentes tamanhos dos dados de entrada.
-| Notação Big-O | Cálculos para 10 elementos | Cálculos para 100 elementos | Cálculos para 1000 elementos |
-| -------------- | ---------------------------- | ----------------------------- | ------------------------------- |
-| **O(1)** | 1 | 1 | 1 |
-| **O(log N)** | 3 | 6 | 9 |
-| **O(N)** | 10 | 100 | 1000 |
-| **O(N log N)** | 30 | 600 | 9000 |
-| **O(N^2)** | 100 | 10000 | 1000000 |
-| **O(2^N)** | 1024 | 1.26e+29 | 1.07e+301 |
-| **O(N!)** | 3628800 | 9.3e+157 | 4.02e+2567 |
+| Notação Big-O | Cálculos para 10 elementos | Cálculos para 100 elementos | Cálculos para 1000 elementos |
+| -------------- | -------------------------- | --------------------------- | ---------------------------- |
+| **O(1)** | 1 | 1 | 1 |
+| **O(log N)** | 3 | 6 | 9 |
+| **O(N)** | 10 | 100 | 1000 |
+| **O(N log N)** | 30 | 600 | 9000 |
+| **O(N^2)** | 100 | 10000 | 1000000 |
+| **O(2^N)** | 1024 | 1.26e+29 | 1.07e+301 |
+| **O(N!)** | 3628800 | 9.3e+157 | 4.02e+2567 |
### Complexidade de operações de estrutura de dados
-| estrutura de dados | Acesso | Busca | Inserção | Eliminação | comentários |
-| ----------------------- | :-------: | :-------: | :-------: | :-------: | :-------- |
-| **Array** | 1 | n | n | n | |
-| **Stack** | n | n | 1 | 1 | |
-| **Queue** | n | n | 1 | 1 | |
-| **Linked List** | n | n | 1 | 1 | |
-| **Hash Table** | - | n | n | n | Em caso de uma função hash perfeita, os custos seriam O (1) |
-| **Binary Search Tree** | n | n | n | n | No caso de custos de árvore equilibrados seria O (log (n))
-| **B-Tree** | log(n) | log(n) | log(n) | log(n) | |
-| **Red-Black Tree** | log(n) | log(n) | log(n) | log(n) | |
-| **AVL Tree** | log(n) | log(n) | log(n) | log(n) | |
-| **Bloom Filter** | - | 1 | 1 | - | Falsos positivos são possíveis durante a pesquisa |
+| estrutura de dados | Acesso | Busca | Inserção | Eliminação | comentários |
+| ---------------------- | :----: | :----: | :------: | :--------: | :---------------------------------------------------------- |
+| **Array** | 1 | n | n | n | |
+| **Stack** | n | n | 1 | 1 | |
+| **Queue** | n | n | 1 | 1 | |
+| **Linked List** | n | n | 1 | 1 | |
+| **Hash Table** | - | n | n | n | Em caso de uma função hash perfeita, os custos seriam O (1) |
+| **Binary Search Tree** | n | n | n | n | No caso de custos de árvore equilibrados seria O (log (n)) |
+| **B-Tree** | log(n) | log(n) | log(n) | log(n) | |
+| **Red-Black Tree** | log(n) | log(n) | log(n) | log(n) | |
+| **AVL Tree** | log(n) | log(n) | log(n) | log(n) | |
+| **Bloom Filter** | - | 1 | 1 | - | Falsos positivos são possíveis durante a pesquisa |
### Array Sorting Algorithms Complexity
-| Nome | Melhor | Média | Pior | Mémoria | Estável | comentários |
-| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- |
-| **Bubble sort** | n | n2 | n2 | 1 | Sim | |
-| **Insertion sort** | n | n2 | n2 | 1 | Sim | |
-| **Selection sort** | n2 | n2 | n2 | 1 | Não | |
-| **Heap sort** | n log(n) | n log(n) | n log(n) | 1 | Não | |
-| **Merge sort** | n log(n) | n log(n) | n log(n) | n | Sim | |
-| **Quick sort** | n log(n) | n log(n) | n2 | log(n) | Não | O Quicksort geralmente é feito no local com o espaço de pilha O O(log(n)) stack space |
-| **Shell sort** | n log(n) | depende da sequência de lacunas | n (log(n))2 | 1 | Não | |
-| **Counting sort** | n + r | n + r | n + r | n + r | Sim | r - maior número na matriz |
-| **Radix sort** | n * k | n * k | n * k | n + k | Sim | k - comprimento da chave mais longa |
+| Nome | Melhor | Média | Pior | Mémoria | Estável | comentários |
+| ------------------ | :-----------: | :-----------------------------: | :-------------------------: | :-----: | :-----: | :------------------------------------------------------------------------------------ |
+| **Bubble sort** | n | n2 | n2 | 1 | Sim | |
+| **Insertion sort** | n | n2 | n2 | 1 | Sim | |
+| **Selection sort** | n2 | n2 | n2 | 1 | Não | |
+| **Heap sort** | n log(n) | n log(n) | n log(n) | 1 | Não | |
+| **Merge sort** | n log(n) | n log(n) | n log(n) | n | Sim | |
+| **Quick sort** | n log(n) | n log(n) | n2 | log(n) | Não | O Quicksort geralmente é feito no local com o espaço de pilha O O(log(n)) stack space |
+| **Shell sort** | n log(n) | depende da sequência de lacunas | n (log(n))2 | 1 | Não | |
+| **Counting sort** | n + r | n + r | n + r | n + r | Sim | r - maior número na matriz |
+| **Radix sort** | n \* k | n \* k | n \* k | n + k | Sim | k - comprimento da chave mais longa |
diff --git a/README.ru-RU.md b/README.ru-RU.md
new file mode 100644
index 0000000000..03a3ba75d0
--- /dev/null
+++ b/README.ru-RU.md
@@ -0,0 +1,310 @@
+# JavaScript алгоритмы и структуры данных
+
+[](https://travis-ci.org/trekhleb/javascript-algorithms)
+[](https://codecov.io/gh/trekhleb/javascript-algorithms)
+
+Этот репозиторий содержит примеры на JavaScript
+множества популярных алгоритмов и структур данных.
+
+Каждый алгоритм и структура данных описана в своем собственном README
+со всеми связанными пояснениями и ссылками для детального изучения
+(включая ссылки на YouTube видео).
+
+_Читайте на других языках:_
+[_简体中文_](README.zh-CN.md),
+[_繁體中文_](README.zh-TW.md),
+[_한국어_](README.ko-KR.md),
+[_日本語_](README.ja-JP.md),
+[_Polski_](README.pl-PL.md),
+[_Français_](README.fr-FR.md),
+[_Español_](README.es-ES.md),
+[_Português_](README.pt-BR.md),
+[_Русский_](README.ru-RU.md)
+
+_☝ Обратите внимание, что этот проект предназначен только для изучения и исследования,
+а **не** для использования в продакшн коде._
+
+## Структуры данных
+
+Структуры данных - это способ организации и хранения данных в компьютере так, что
+к этим данным можно эффективно и быстро получить доступ и их изменить.
+Если говорить более точно, то структуры данных это множество значений, связанных друг с другом,
+а также функции или операции для работы с этими данными.
+
+`B` - Новичок, `A` - Продвинутый
+
+- `Н` [Linked List - Связный список](src/data-structures/linked-list)
+- `Н` [Doubly Linked List - Двусвязный список](src/data-structures/doubly-linked-list)
+- `Н` [Queue - Очередь](src/data-structures/queue)
+- `Н` [Stack - Стек](src/data-structures/stack)
+- `Н` [Hash Table - Хеш-таблица](src/data-structures/hash-table)
+- `Н` [Heap - Куча](src/data-structures/heap) - максимальная и минимальная версии кучи
+- `Н` [Priority Queue - Очередь с приоритетом](src/data-structures/priority-queue)
+- `П` [Trie - Префиксное дерево](src/data-structures/trie)
+- `П` [Tree - Дерево](src/data-structures/tree)
+ - `П` [Binary Search Tree - Бинарное дерево поиска](src/data-structures/tree/binary-search-tree)
+ - `П` [AVL Tree - АВЛ Дерево](src/data-structures/tree/avl-tree)
+ - `П` [Red-Black Tree - Красно-черные деревья](src/data-structures/tree/red-black-tree)
+ - `П` [Segment Tree - Дерево отрезков](src/data-structures/tree/segment-tree) - с примерами запросов min/max/sum
+ - `П` [Fenwick Tree - Дерево Фенвика](src/data-structures/tree/fenwick-tree) (Бинарное Индексное дерево)
+- `П` [Graph - Граф](src/data-structures/graph) (Рассматриваются ориентированные и неориентированные)
+- `П` [Disjoint Set - Система непересекающихся множеств](src/data-structures/disjoint-set)
+- `П` [Bloom Filter - Фильтр Блума](src/data-structures/bloom-filter)
+
+## Алгоритмы
+
+Алгоритм - это однозначная спецификация способа решения класса задач.
+Это набор правил, которые точно определяют последовательность операций.
+
+`Н` - Новичок, `П` - Продвинутый
+
+### Алгоритмы по темам
+
+- **Математические**
+ - `Н` [Bit Manipulation](src/algorithms/math/bits) - set/get/update/clear bits, multiplication/division by two, make negative etc.
+ - `Н` [Factorial](src/algorithms/math/factorial)
+ - `Н` [Fibonacci Number](src/algorithms/math/fibonacci) - classic and closed-form versions
+ - `Н` [Primality Test](src/algorithms/math/primality-test) (trial division method)
+ - `Н` [Euclidean Algorithm](src/algorithms/math/euclidean-algorithm) - calculate the Greatest Common Divisor (GCD)
+ - `Н` [Least Common Multiple](src/algorithms/math/least-common-multiple) (LCM)
+ - `Н` [Sieve of Eratosthenes](src/algorithms/math/sieve-of-eratosthenes) - finding all prime numbers up to any given limit
+ - `Н` [Is Power of Two](src/algorithms/math/is-power-of-two) - check if the number is power of two (naive and bitwise algorithms)
+ - `Н` [Pascal's Triangle](src/algorithms/math/pascal-triangle)
+ - `Н` [Complex Number](src/algorithms/math/complex-number) - complex numbers and basic operations with them
+ - `Н` [Radian & Degree](src/algorithms/math/radian) - radians to degree and backwards conversion
+ - `Н` [Fast Powering](src/algorithms/math/fast-powering)
+ - `П` [Integer Partition](src/algorithms/math/integer-partition)
+ - `П` [Square Root](src/algorithms/math/square-root) - Newton's method
+ - `П` [Liu Hui π Algorithm](src/algorithms/math/liu-hui) - approximate π calculations based on N-gons
+ - `П` [Discrete Fourier Transform](src/algorithms/math/fourier-transform) - decompose a function of time (a signal) into the frequencies that make it up
+- **Множества**
+ - `Н` [Cartesian Product](src/algorithms/sets/cartesian-product) - product of multiple sets
+ - `Н` [Fisher–Yates Shuffle](src/algorithms/sets/fisher-yates) - random permutation of a finite sequence
+ - `П` [Power Set](src/algorithms/sets/power-set) - all subsets of a set (bitwise and backtracking solutions)
+ - `П` [Permutations](src/algorithms/sets/permutations) (with and without repetitions)
+ - `П` [Combinations](src/algorithms/sets/combinations) (with and without repetitions)
+ - `П` [Longest Common Subsequence](src/algorithms/sets/longest-common-subsequence) (LCS)
+ - `П` [Longest Increasing Subsequence](src/algorithms/sets/longest-increasing-subsequence)
+ - `П` [Shortest Common Supersequence](src/algorithms/sets/shortest-common-supersequence) (SCS)
+ - `П` [Knapsack Problem](src/algorithms/sets/knapsack-problem) - "0/1" and "Unbound" ones
+ - `П` [Maximum Subarray](src/algorithms/sets/maximum-subarray) - "Brute Force" and "Dynamic Programming" (Kadane's) versions
+ - `П` [Combination Sum](src/algorithms/sets/combination-sum) - find all combinations that form specific sum
+- **Строки**
+ - `Н` [Hamming Distance](src/algorithms/string/hamming-distance) - number of positions at which the symbols are different
+ - `П` [Levenshtein Distance](src/algorithms/string/levenshtein-distance) - minimum edit distance between two sequences
+ - `П` [Knuth–Morris–Pratt Algorithm](src/algorithms/string/knuth-morris-pratt) (KMP Algorithm) - substring search (pattern matching)
+ - `П` [Z Algorithm](src/algorithms/string/z-algorithm) - substring search (pattern matching)
+ - `П` [Rabin Karp Algorithm](src/algorithms/string/rabin-karp) - substring search
+ - `П` [Longest Common Substring](src/algorithms/string/longest-common-substring)
+ - `П` [Regular Expression Matching](src/algorithms/string/regular-expression-matching)
+- **Поиск**
+ - `Н` [Linear Search](src/algorithms/search/linear-search)
+ - `Н` [Jump Search](src/algorithms/search/jump-search) (or Block Search) - search in sorted array
+ - `Н` [Binary Search](src/algorithms/search/binary-search) - search in sorted array
+ - `Н` [Interpolation Search](src/algorithms/search/interpolation-search) - search in uniformly distributed sorted array
+- **Сортировка**
+ - `Н` [Bubble Sort](src/algorithms/sorting/bubble-sort)
+ - `Н` [Selection Sort](src/algorithms/sorting/selection-sort)
+ - `Н` [Insertion Sort](src/algorithms/sorting/insertion-sort)
+ - `Н` [Heap Sort](src/algorithms/sorting/heap-sort)
+ - `Н` [Merge Sort](src/algorithms/sorting/merge-sort)
+ - `Н` [Quicksort](src/algorithms/sorting/quick-sort) - in-place and non-in-place implementations
+ - `Н` [Shellsort](src/algorithms/sorting/shell-sort)
+ - `Н` [Counting Sort](src/algorithms/sorting/counting-sort)
+ - `Н` [Radix Sort](src/algorithms/sorting/radix-sort)
+- **Связные списки**
+ - `Н` [Straight Traversal](src/algorithms/linked-list/traversal)
+ - `Н` [Reverse Traversal](src/algorithms/linked-list/reverse-traversal)
+- **Деревья**
+ - `Н` [Depth-First Search](src/algorithms/tree/depth-first-search) (DFS)
+ - `Н` [Breadth-First Search](src/algorithms/tree/breadth-first-search) (BFS)
+- **Графы**
+ - `Н` [Depth-First Search](src/algorithms/graph/depth-first-search) (DFS)
+ - `Н` [Breadth-First Search](src/algorithms/graph/breadth-first-search) (BFS)
+ - `Н` [Kruskal’s Algorithm](src/algorithms/graph/kruskal) - finding Minimum Spanning Tree (MST) for weighted undirected graph
+ - `П` [Dijkstra Algorithm](src/algorithms/graph/dijkstra) - finding shortest paths to all graph vertices from single vertex
+ - `П` [Bellman-Ford Algorithm](src/algorithms/graph/bellman-ford) - finding shortest paths to all graph vertices from single vertex
+ - `П` [Floyd-Warshall Algorithm](src/algorithms/graph/floyd-warshall) - find shortest paths between all pairs of vertices
+ - `П` [Detect Cycle](src/algorithms/graph/detect-cycle) - for both directed and undirected graphs (DFS and Disjoint Set based versions)
+ - `П` [Prim’s Algorithm](src/algorithms/graph/prim) - finding Minimum Spanning Tree (MST) for weighted undirected graph
+ - `П` [Topological Sorting](src/algorithms/graph/topological-sorting) - DFS method
+ - `П` [Articulation Points](src/algorithms/graph/articulation-points) - Tarjan's algorithm (DFS based)
+ - `П` [Bridges](src/algorithms/graph/bridges) - DFS based algorithm
+ - `П` [Eulerian Path and Eulerian Circuit](src/algorithms/graph/eulerian-path) - Fleury's algorithm - Visit every edge exactly once
+ - `П` [Hamiltonian Cycle](src/algorithms/graph/hamiltonian-cycle) - Visit every vertex exactly once
+ - `П` [Strongly Connected Components](src/algorithms/graph/strongly-connected-components) - Kosaraju's algorithm
+ - `П` [Travelling Salesman Problem](src/algorithms/graph/travelling-salesman) - shortest possible route that visits each city and returns to the origin city
+- **Криптография**
+ - `Н` [Polynomial Hash](src/algorithms/cryptography/polynomial-hash) - rolling hash function based on polynomial
+- **Машинное обучение**
+ - `Н` [NanoNeuron](https://github.com/trekhleb/nano-neuron) - 7 simple JS functions that illustrate how machines can actually learn (forward/backward propagation)
+- **Без категории**
+ - `Н` [Tower of Hanoi](src/algorithms/uncategorized/hanoi-tower)
+ - `Н` [Square Matrix Rotation](src/algorithms/uncategorized/square-matrix-rotation) - in-place algorithm
+ - `Н` [Jump Game](src/algorithms/uncategorized/jump-game) - backtracking, dynamic programming (top-down + bottom-up) and greedy examples
+ - `Н` [Unique Paths](src/algorithms/uncategorized/unique-paths) - backtracking, dynamic programming and Pascal's Triangle based examples
+ - `Н` [Rain Terraces](src/algorithms/uncategorized/rain-terraces) - trapping rain water problem (dynamic programming and brute force versions)
+ - `Н` [Recursive Staircase](src/algorithms/uncategorized/recursive-staircase) - count the number of ways to reach to the top (4 solutions)
+ - `П` [N-Queens Problem](src/algorithms/uncategorized/n-queens)
+ - `П` [Knight's Tour](src/algorithms/uncategorized/knight-tour)
+
+### Алгоритмы по парадигмам
+
+Алгоритмическая парадигма — это общий метод или подход, лежащий в основе класса алгоритмов.
+Это такая же абстракция над алгоритмом, как алгоритм является абстракцией компьютерной программы.
+
+- **Перебор - Brute Force** - look at all the possibilities and selects the best solution
+ - `B` [Linear Search](src/algorithms/search/linear-search)
+ - `B` [Rain Terraces](src/algorithms/uncategorized/rain-terraces) - trapping rain water problem
+ - `B` [Recursive Staircase](src/algorithms/uncategorized/recursive-staircase) - count the number of ways to reach to the top
+ - `A` [Maximum Subarray](src/algorithms/sets/maximum-subarray)
+ - `A` [Travelling Salesman Problem](src/algorithms/graph/travelling-salesman) - shortest possible route that visits each city and returns to the origin city
+ - `A` [Discrete Fourier Transform](src/algorithms/math/fourier-transform) - decompose a function of time (a signal) into the frequencies that make it up
+- **Жадные** - choose the best option at the current time, without any consideration for the future
+ - `B` [Jump Game](src/algorithms/uncategorized/jump-game)
+ - `A` [Unbound Knapsack Problem](src/algorithms/sets/knapsack-problem)
+ - `A` [Dijkstra Algorithm](src/algorithms/graph/dijkstra) - finding shortest path to all graph vertices
+ - `A` [Prim’s Algorithm](src/algorithms/graph/prim) - finding Minimum Spanning Tree (MST) for weighted undirected graph
+ - `A` [Kruskal’s Algorithm](src/algorithms/graph/kruskal) - finding Minimum Spanning Tree (MST) for weighted undirected graph
+- **Разделяй и властвуй** - divide the problem into smaller parts and then solve those parts
+ - `B` [Binary Search](src/algorithms/search/binary-search)
+ - `B` [Tower of Hanoi](src/algorithms/uncategorized/hanoi-tower)
+ - `B` [Pascal's Triangle](src/algorithms/math/pascal-triangle)
+ - `B` [Euclidean Algorithm](src/algorithms/math/euclidean-algorithm) - calculate the Greatest Common Divisor (GCD)
+ - `B` [Merge Sort](src/algorithms/sorting/merge-sort)
+ - `B` [Quicksort](src/algorithms/sorting/quick-sort)
+ - `B` [Tree Depth-First Search](src/algorithms/tree/depth-first-search) (DFS)
+ - `B` [Graph Depth-First Search](src/algorithms/graph/depth-first-search) (DFS)
+ - `B` [Jump Game](src/algorithms/uncategorized/jump-game)
+ - `B` [Fast Powering](src/algorithms/math/fast-powering)
+ - `A` [Permutations](src/algorithms/sets/permutations) (with and without repetitions)
+ - `A` [Combinations](src/algorithms/sets/combinations) (with and without repetitions)
+- **Динамическое программирование** - build up a solution using previously found sub-solutions
+ - `B` [Fibonacci Number](src/algorithms/math/fibonacci)
+ - `B` [Jump Game](src/algorithms/uncategorized/jump-game)
+ - `B` [Unique Paths](src/algorithms/uncategorized/unique-paths)
+ - `B` [Rain Terraces](src/algorithms/uncategorized/rain-terraces) - trapping rain water problem
+ - `B` [Recursive Staircase](src/algorithms/uncategorized/recursive-staircase) - count the number of ways to reach to the top
+ - `A` [Levenshtein Distance](src/algorithms/string/levenshtein-distance) - minimum edit distance between two sequences
+ - `A` [Longest Common Subsequence](src/algorithms/sets/longest-common-subsequence) (LCS)
+ - `A` [Longest Common Substring](src/algorithms/string/longest-common-substring)
+ - `A` [Longest Increasing Subsequence](src/algorithms/sets/longest-increasing-subsequence)
+ - `A` [Shortest Common Supersequence](src/algorithms/sets/shortest-common-supersequence)
+ - `A` [0/1 Knapsack Problem](src/algorithms/sets/knapsack-problem)
+ - `A` [Integer Partition](src/algorithms/math/integer-partition)
+ - `A` [Maximum Subarray](src/algorithms/sets/maximum-subarray)
+ - `A` [Bellman-Ford Algorithm](src/algorithms/graph/bellman-ford) - finding shortest path to all graph vertices
+ - `A` [Floyd-Warshall Algorithm](src/algorithms/graph/floyd-warshall) - find shortest paths between all pairs of vertices
+ - `A` [Regular Expression Matching](src/algorithms/string/regular-expression-matching)
+- **Поиск с возвратом** - similarly to brute force, try to generate all possible solutions, but each time you generate next solution you test
+ if it satisfies all conditions, and only then continue generating subsequent solutions. Otherwise, backtrack, and go on a
+ different path of finding a solution. Normally the DFS traversal of state-space is being used.
+ - `B` [Jump Game](src/algorithms/uncategorized/jump-game)
+ - `B` [Unique Paths](src/algorithms/uncategorized/unique-paths)
+ - `B` [Power Set](src/algorithms/sets/power-set) - all subsets of a set
+ - `A` [Hamiltonian Cycle](src/algorithms/graph/hamiltonian-cycle) - Visit every vertex exactly once
+ - `A` [N-Queens Problem](src/algorithms/uncategorized/n-queens)
+ - `A` [Knight's Tour](src/algorithms/uncategorized/knight-tour)
+ - `A` [Combination Sum](src/algorithms/sets/combination-sum) - find all combinations that form specific sum
+- **Branch & Bound** - remember the lowest-cost solution found at each stage of the backtracking
+ search, and use the cost of the lowest-cost solution found so far as a lower bound on the cost of
+ a least-cost solution to the problem, in order to discard partial solutions with costs larger than the
+ lowest-cost solution found so far. Normally BFS traversal in combination with DFS traversal of state-space
+ tree is being used.
+
+## Как использовать этот репозиторий
+
+**Установка всех зависимостей**
+
+```
+npm install
+```
+
+**Запуск ESLint**
+
+Вы можете запустить проверку качества кода.
+
+```
+npm run lint
+```
+
+**Запуск всех тестов**
+
+```
+npm test
+```
+
+**Запуск тестов по имени**
+
+```
+npm test -- 'LinkedList'
+```
+
+**Песочница**
+
+Вы можете поиграть со структурами данных и алгоритмами в файле `./src/playground/playground.js`
+и написать тесты для него в `./src/playground/__test__/playground.test.js`.
+
+Затем просто запустите следующую команду для проверки кода в песочнице на соответствие тому,
+что вы задумали:
+
+```
+npm test -- 'playground'
+```
+
+## Полезная информация
+
+### Ссылки
+
+[▶ Data Structures and Algorithms on YouTube](https://www.youtube.com/playlist?list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8)
+
+### Нотация большое О
+
+_Нотация большое О_ используется для классификации алгоритмов по их времени выполнения или
+по росту памяти с ростом числа элементов во входных данных. На графике ниже вы можете увидеть
+наиболее частые порядки роста алгоритмов, обозначенные с помощью нотации большое О.
+
+
+
+Source: [Big O Cheat Sheet](http://bigocheatsheet.com/).
+
+Ниже приведена таблица некоторых из частоиспользуемых нотаций большого О и сравнение их производительности с ростом входных данных.
+
+| Нотация большое О | Обработка 10 элементов | Обработка 100 элементов | Обработка 1000 элементов |
+| ----------------- | ---------------------- | ----------------------- | ------------------------ |
+| **O(1)** | 1 | 1 | 1 |
+| **O(log N)** | 3 | 6 | 9 |
+| **O(N)** | 10 | 100 | 1000 |
+| **O(N log N)** | 30 | 600 | 9000 |
+| **O(N^2)** | 100 | 10000 | 1000000 |
+| **O(2^N)** | 1024 | 1.26e+29 | 1.07e+301 |
+| **O(N!)** | 3628800 | 9.3e+157 | 4.02e+2567 |
+
+### Сложность операций со структурами данных
+
+| Структура данных | Доступ | Поиск | Вставка | Удаление | Комментарий |
+| ---------------------- | :----: | :----: | :-----: | :------: | :--------------------------------------------------- |
+| **Array** | 1 | n | n | n | |
+| **Stack** | n | n | 1 | 1 | |
+| **Queue** | n | n | 1 | 1 | |
+| **Linked List** | n | n | 1 | n | |
+| **Hash Table** | - | n | n | n | In case of perfect hash function costs would be O(1) |
+| **Binary Search Tree** | n | n | n | n | In case of balanced tree costs would be O(log(n)) |
+| **B-Tree** | log(n) | log(n) | log(n) | log(n) | |
+| **Red-Black Tree** | log(n) | log(n) | log(n) | log(n) | |
+| **AVL Tree** | log(n) | log(n) | log(n) | log(n) | |
+| **Bloom Filter** | - | 1 | 1 | - | False positives are possible while searching |
+
+### Сложность алгоритмов сортировки массивов
+
+| Имя | Лучший | Средний | Худший | Память | Устойчивость | Комментарий |
+| ------------------ | :-----------: | :---------------------: | :-------------------------: | :----: | :----------: | :------------------------------------------------------------ |
+| **Bubble sort** | n | n2 | n2 | 1 | Yes | |
+| **Insertion sort** | n | n2 | n2 | 1 | Yes | |
+| **Selection sort** | n2 | n2 | n2 | 1 | No | |
+| **Heap sort** | n log(n) | n log(n) | n log(n) | 1 | No | |
+| **Merge sort** | n log(n) | n log(n) | n log(n) | n | Yes | |
+| **Quick sort** | n log(n) | n log(n) | n2 | log(n) | No | Quicksort is usually done in-place with O(log(n)) stack space |
+| **Shell sort** | n log(n) | depends on gap sequence | n (log(n))2 | 1 | No | |
+| **Counting sort** | n + r | n + r | n + r | n + r | Yes | r - biggest number in array |
+| **Radix sort** | n \* k | n \* k | n \* k | n + k | Yes | k - length of longest key |
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 0f33c608f0..c0ffd54cbb 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -15,9 +15,10 @@ _Read this in other languages:_
[_Polski_](README.pl-PL.md),
[_Français_](README.fr-FR.md),
[_Español_](README.es-ES.md),
-[_Português_](README.pt-BR.md)
+[_Português_](README.pt-BR.md),
+[_Русский_](README.ru-RU.md)
-*注意:这个项目仅用于学习和研究,**不是**用于生产环境。*
+_注意:这个项目仅用于学习和研究,**不是**用于生产环境。_
## 数据结构
@@ -25,23 +26,23 @@ _Read this in other languages:_
`B` - 初学者, `A` - 进阶
-* `B` [链表](src/data-structures/linked-list/README.zh-CN.md)
-* `B` [双向链表](src/data-structures/doubly-linked-list/README.zh-CN.md)
-* `B` [队列](src/data-structures/queue/README.zh-CN.md)
-* `B` [栈](src/data-structures/stack/README.zh-CN.md)
-* `B` [哈希表](src/data-structures/hash-table/README.zh-CN.md)
-* `B` [堆](src/data-structures/heap/README.zh-CN.md) - 最大堆 & 最小堆
-* `B` [优先队列](src/data-structures/priority-queue/README.zh-CN.md)
-* `A` [字典树](src/data-structures/trie/README.zh-CN.md)
-* `A` [树](src/data-structures/tree/README.zh-CN.md)
- * `A` [二叉查找树](src/data-structures/tree/binary-search-tree)
- * `A` [AVL 树](src/data-structures/tree/avl-tree)
- * `A` [红黑树](src/data-structures/tree/red-black-tree)
- * `A` [线段树](src/data-structures/tree/segment-tree) - 使用 `最小/最大/总和` 范围查询示例
- * `A` [树状数组](src/data-structures/tree/fenwick-tree) (二叉索引树)
-* `A` [图](src/data-structures/graph/README.zh-CN.md) (有向图与无向图)
-* `A` [并查集](src/data-structures/disjoint-set)
-* `A` [布隆过滤器](src/data-structures/bloom-filter)
+- `B` [链表](src/data-structures/linked-list/README.zh-CN.md)
+- `B` [双向链表](src/data-structures/doubly-linked-list/README.zh-CN.md)
+- `B` [队列](src/data-structures/queue/README.zh-CN.md)
+- `B` [栈](src/data-structures/stack/README.zh-CN.md)
+- `B` [哈希表](src/data-structures/hash-table/README.zh-CN.md)
+- `B` [堆](src/data-structures/heap/README.zh-CN.md) - 最大堆 & 最小堆
+- `B` [优先队列](src/data-structures/priority-queue/README.zh-CN.md)
+- `A` [字典树](src/data-structures/trie/README.zh-CN.md)
+- `A` [树](src/data-structures/tree/README.zh-CN.md)
+ - `A` [二叉查找树](src/data-structures/tree/binary-search-tree)
+ - `A` [AVL 树](src/data-structures/tree/avl-tree)
+ - `A` [红黑树](src/data-structures/tree/red-black-tree)
+ - `A` [线段树](src/data-structures/tree/segment-tree) - 使用 `最小/最大/总和` 范围查询示例
+ - `A` [树状数组](src/data-structures/tree/fenwick-tree) (二叉索引树)
+- `A` [图](src/data-structures/graph/README.zh-CN.md) (有向图与无向图)
+- `A` [并查集](src/data-structures/disjoint-set)
+- `A` [布隆过滤器](src/data-structures/bloom-filter)
## 算法
@@ -51,151 +52,152 @@ _Read this in other languages:_
### 算法主题
-* **数学**
- * `B` [Bit 操控](src/algorithms/math/bits) - set/get/update/clear 位、乘以/除以二进制位 、变负等
- * `B` [阶乘](src/algorithms/math/factorial/README.zh-CN.md)
- * `B` [斐波那契数](src/algorithms/math/fibonacci) - `经典` 和 `闭式` 版本
- * `B` [素数检测](src/algorithms/math/primality-test) (排除法)
- * `B` [欧几里得算法](src/algorithms/math/euclidean-algorithm) - 计算最大公约数 (GCD)
- * `B` [最小公倍数](src/algorithms/math/least-common-multiple) (LCM)
- * `B` [素数筛](src/algorithms/math/sieve-of-eratosthenes) - 查找任意给定范围内的所有素数
- * `B` [判断 2 次方数](src/algorithms/math/is-power-of-two) - 检查数字是否为 2 的幂 (原生和按位算法)
- * `B` [杨辉三角形](src/algorithms/math/pascal-triangle)
- * `B` [复数](src/algorithms/math/complex-number) - 复数及其基本运算
- * `B` [弧度和角](src/algorithms/math/radian) - 弧度与角的相互转换
- * `B` [快速算次方](src/algorithms/math/fast-powering)
- * `A` [整数拆分](src/algorithms/math/integer-partition)
- * `A` [割圆术](src/algorithms/math/liu-hui) - 基于 N-gons 的近似 π 计算
- * `A` [离散傅里叶变换](src/algorithms/math/fourier-transform) - 把时间信号解析成构成它的频率
-* **集合**
- * `B` [笛卡尔积](src/algorithms/sets/cartesian-product) - 多集合结果
- * `A` [洗牌算法](src/algorithms/sets/fisher-yates) - 随机置换有限序列
- * `A` [幂集](src/algorithms/sets/power-set) - 该集合的所有子集
- * `A` [排列](src/algorithms/sets/permutations) (有/无重复)
- * `A` [组合](src/algorithms/sets/combinations) (有/无重复)
- * `A` [最长公共子序列](src/algorithms/sets/longest-common-subsequence) (LCS)
- * `A` [最长递增子序列](src/algorithms/sets/longest-increasing-subsequence)
- * `A` [最短公共父序列](src/algorithms/sets/shortest-common-supersequence) (SCS)
- * `A` [背包问题](src/algorithms/sets/knapsack-problem) - `0/1` 和 `无边界` 问题
- * `A` [最大子数列问题](src/algorithms/sets/maximum-subarray) - `BF 算法` 和 `动态规划`
- * `A` [组合求和](src/algorithms/sets/combination-sum) - 查找形成特定总和的所有组合
-* **字符串**
- * `B` [汉明距离](src/algorithms/string/hamming-distance) - 符号不同的位置数
- * `A` [莱温斯坦距离](src/algorithms/string/levenshtein-distance) - 两个序列之间的最小编辑距离
- * `A` [Knuth–Morris–Pratt 算法](src/algorithms/string/knuth-morris-pratt) KMP 算法 - 子串搜索 (模式匹配)
- * `A` [字符串快速查找](src/algorithms/string/rabin-karp) - 子串搜索 (模式匹配)
- * `A` [Rabin Karp 算法](src/algorithms/string/rabin-karp) - 子串搜索
- * `A` [最长公共子串](src/algorithms/string/longest-common-substring)
- * `A` [正则表达式匹配](src/algorithms/string/regular-expression-matching)
-* **搜索**
- * `B` [线性搜索](src/algorithms/search/linear-search)
- * `B` [跳转搜索/块搜索](src/algorithms/search/jump-search) - 搜索有序数组
- * `B` [二分查找](src/algorithms/search/binary-search) - 搜索有序数组
- * `B` [插值搜索](src/algorithms/search/interpolation-search) - 搜索均匀分布的有序数组
-* **排序**
- * `B` [冒泡排序](src/algorithms/sorting/bubble-sort)
- * `B` [选择排序](src/algorithms/sorting/selection-sort)
- * `B` [插入排序](src/algorithms/sorting/insertion-sort)
- * `B` [堆排序](src/algorithms/sorting/heap-sort)
- * `B` [归并排序](src/algorithms/sorting/merge-sort)
- * `B` [快速排序](src/algorithms/sorting/quick-sort) - in-place (原地) 和 non-in-place 版本
- * `B` [希尔排序](src/algorithms/sorting/shell-sort)
- * `B` [计数排序](src/algorithms/sorting/counting-sort)
- * `B` [基数排序](src/algorithms/sorting/radix-sort)
-* **链表**
+- **数学**
+ - `B` [Bit 操控](src/algorithms/math/bits) - set/get/update/clear 位、乘以/除以二进制位 、变负等
+ - `B` [阶乘](src/algorithms/math/factorial/README.zh-CN.md)
+ - `B` [斐波那契数](src/algorithms/math/fibonacci) - `经典` 和 `闭式` 版本
+ - `B` [素数检测](src/algorithms/math/primality-test) (排除法)
+ - `B` [欧几里得算法](src/algorithms/math/euclidean-algorithm) - 计算最大公约数 (GCD)
+ - `B` [最小公倍数](src/algorithms/math/least-common-multiple) (LCM)
+ - `B` [素数筛](src/algorithms/math/sieve-of-eratosthenes) - 查找任意给定范围内的所有素数
+ - `B` [判断 2 次方数](src/algorithms/math/is-power-of-two) - 检查数字是否为 2 的幂 (原生和按位算法)
+ - `B` [杨辉三角形](src/algorithms/math/pascal-triangle)
+ - `B` [复数](src/algorithms/math/complex-number) - 复数及其基本运算
+ - `B` [弧度和角](src/algorithms/math/radian) - 弧度与角的相互转换
+ - `B` [快速算次方](src/algorithms/math/fast-powering)
+ - `A` [整数拆分](src/algorithms/math/integer-partition)
+ - `A` [割圆术](src/algorithms/math/liu-hui) - 基于 N-gons 的近似 π 计算
+ - `A` [离散傅里叶变换](src/algorithms/math/fourier-transform) - 把时间信号解析成构成它的频率
+- **集合**
+ - `B` [笛卡尔积](src/algorithms/sets/cartesian-product) - 多集合结果
+ - `A` [洗牌算法](src/algorithms/sets/fisher-yates) - 随机置换有限序列
+ - `A` [幂集](src/algorithms/sets/power-set) - 该集合的所有子集
+ - `A` [排列](src/algorithms/sets/permutations) (有/无重复)
+ - `A` [组合](src/algorithms/sets/combinations) (有/无重复)
+ - `A` [最长公共子序列](src/algorithms/sets/longest-common-subsequence) (LCS)
+ - `A` [最长递增子序列](src/algorithms/sets/longest-increasing-subsequence)
+ - `A` [最短公共父序列](src/algorithms/sets/shortest-common-supersequence) (SCS)
+ - `A` [背包问题](src/algorithms/sets/knapsack-problem) - `0/1` 和 `无边界` 问题
+ - `A` [最大子数列问题](src/algorithms/sets/maximum-subarray) - `BF 算法` 和 `动态规划`
+ - `A` [组合求和](src/algorithms/sets/combination-sum) - 查找形成特定总和的所有组合
+- **字符串**
+ - `B` [汉明距离](src/algorithms/string/hamming-distance) - 符号不同的位置数
+ - `A` [莱温斯坦距离](src/algorithms/string/levenshtein-distance) - 两个序列之间的最小编辑距离
+ - `A` [Knuth–Morris–Pratt 算法](src/algorithms/string/knuth-morris-pratt) KMP 算法 - 子串搜索 (模式匹配)
+ - `A` [字符串快速查找](src/algorithms/string/rabin-karp) - 子串搜索 (模式匹配)
+ - `A` [Rabin Karp 算法](src/algorithms/string/rabin-karp) - 子串搜索
+ - `A` [最长公共子串](src/algorithms/string/longest-common-substring)
+ - `A` [正则表达式匹配](src/algorithms/string/regular-expression-matching)
+- **搜索**
+ - `B` [线性搜索](src/algorithms/search/linear-search)
+ - `B` [跳转搜索/块搜索](src/algorithms/search/jump-search) - 搜索有序数组
+ - `B` [二分查找](src/algorithms/search/binary-search) - 搜索有序数组
+ - `B` [插值搜索](src/algorithms/search/interpolation-search) - 搜索均匀分布的有序数组
+- **排序**
+ - `B` [冒泡排序](src/algorithms/sorting/bubble-sort)
+ - `B` [选择排序](src/algorithms/sorting/selection-sort)
+ - `B` [插入排序](src/algorithms/sorting/insertion-sort)
+ - `B` [堆排序](src/algorithms/sorting/heap-sort)
+ - `B` [归并排序](src/algorithms/sorting/merge-sort)
+ - `B` [快速排序](src/algorithms/sorting/quick-sort) - in-place (原地) 和 non-in-place 版本
+ - `B` [希尔排序](src/algorithms/sorting/shell-sort)
+ - `B` [计数排序](src/algorithms/sorting/counting-sort)
+ - `B` [基数排序](src/algorithms/sorting/radix-sort)
+- **链表**
- `B` [正向遍历](src/algorithms/linked-list/traversal)
- `B` [反向遍历](src/algorithms/linked-list/reverse-traversal)
-* **树**
- * `B` [深度优先搜索](src/algorithms/tree/depth-first-search) (DFS)
- * `B` [广度优先搜索](src/algorithms/tree/breadth-first-search) (BFS)
-* **图**
- * `B` [深度优先搜索](src/algorithms/graph/depth-first-search) (DFS)
- * `B` [广度优先搜索](src/algorithms/graph/breadth-first-search) (BFS)
- * `B` [克鲁斯克尔演算法](src/algorithms/graph/kruskal) - 寻找加权无向图的最小生成树 (MST)
- * `A` [戴克斯特拉算法](src/algorithms/graph/dijkstra) - 找到图中所有顶点的最短路径
- * `A` [贝尔曼-福特算法](src/algorithms/graph/bellman-ford) - 找到图中所有顶点的最短路径
- * `A` [弗洛伊德算法](src/algorithms/graph/floyd-warshall) - 找到所有顶点对 之间的最短路径
- * `A` [判圈算法](src/algorithms/graph/detect-cycle) - 对于有向图和无向图 (基于 DFS 和不相交集的版本)
- * `A` [普林演算法](src/algorithms/graph/prim) - 寻找加权无向图的最小生成树 (MST)
- * `A` [拓扑排序](src/algorithms/graph/topological-sorting) - DFS 方法
- * `A` [关节点](src/algorithms/graph/articulation-points) - Tarjan 算法 (基于 DFS)
- * `A` [桥](src/algorithms/graph/bridges) - 基于 DFS 的算法
- * `A` [欧拉回径与一笔画问题](src/algorithms/graph/eulerian-path) - Fleury 的算法 - 一次访问每个边
- * `A` [哈密顿图](src/algorithms/graph/hamiltonian-cycle) - 恰好访问每个顶点一次
- * `A` [强连通分量](src/algorithms/graph/strongly-connected-components) - Kosaraju 算法
- * `A` [旅行推销员问题](src/algorithms/graph/travelling-salesman) - 尽可能以最短的路线访问每个城市并返回原始城市
-* **加密**
- * `B` [多项式 hash](src/algorithms/cryptography/polynomial-hash) - 基于多项式的 rolling hash 函数
-* **未分类**
- * `B` [汉诺塔](src/algorithms/uncategorized/hanoi-tower)
- * `B` [旋转矩阵](src/algorithms/uncategorized/square-matrix-rotation) - 原地算法
- * `B` [跳跃游戏](src/algorithms/uncategorized/jump-game) - 回溯,、动态编程 (自上而下+自下而上) 和贪婪的例子
- * `B` [独特(唯一) 路径](src/algorithms/uncategorized/unique-paths) - 回溯、动态编程和基于 Pascal 三角形的例子
- * `B` [雨水收集](src/algorithms/uncategorized/rain-terraces) - 诱捕雨水问题 (动态编程和暴力版本)
- * `B` [递归楼梯](src/algorithms/uncategorized/recursive-staircase) - 计算有共有多少种方法可以到达顶层 (4 种解题方案)
- * `A` [八皇后问题](src/algorithms/uncategorized/n-queens)
- * `A` [骑士巡逻](src/algorithms/uncategorized/knight-tour)
+- **树**
+ - `B` [深度优先搜索](src/algorithms/tree/depth-first-search) (DFS)
+ - `B` [广度优先搜索](src/algorithms/tree/breadth-first-search) (BFS)
+- **图**
+ - `B` [深度优先搜索](src/algorithms/graph/depth-first-search) (DFS)
+ - `B` [广度优先搜索](src/algorithms/graph/breadth-first-search) (BFS)
+ - `B` [克鲁斯克尔演算法](src/algorithms/graph/kruskal) - 寻找加权无向图的最小生成树 (MST)
+ - `A` [戴克斯特拉算法](src/algorithms/graph/dijkstra) - 找到图中所有顶点的最短路径
+ - `A` [贝尔曼-福特算法](src/algorithms/graph/bellman-ford) - 找到图中所有顶点的最短路径
+ - `A` [弗洛伊德算法](src/algorithms/graph/floyd-warshall) - 找到所有顶点对 之间的最短路径
+ - `A` [判圈算法](src/algorithms/graph/detect-cycle) - 对于有向图和无向图 (基于 DFS 和不相交集的版本)
+ - `A` [普林演算法](src/algorithms/graph/prim) - 寻找加权无向图的最小生成树 (MST)
+ - `A` [拓扑排序](src/algorithms/graph/topological-sorting) - DFS 方法
+ - `A` [关节点](src/algorithms/graph/articulation-points) - Tarjan 算法 (基于 DFS)
+ - `A` [桥](src/algorithms/graph/bridges) - 基于 DFS 的算法
+ - `A` [欧拉回径与一笔画问题](src/algorithms/graph/eulerian-path) - Fleury 的算法 - 一次访问每个边
+ - `A` [哈密顿图](src/algorithms/graph/hamiltonian-cycle) - 恰好访问每个顶点一次
+ - `A` [强连通分量](src/algorithms/graph/strongly-connected-components) - Kosaraju 算法
+ - `A` [旅行推销员问题](src/algorithms/graph/travelling-salesman) - 尽可能以最短的路线访问每个城市并返回原始城市
+- **加密**
+ - `B` [多项式 hash](src/algorithms/cryptography/polynomial-hash) - 基于多项式的 rolling hash 函数
+- **未分类**
+ - `B` [汉诺塔](src/algorithms/uncategorized/hanoi-tower)
+ - `B` [旋转矩阵](src/algorithms/uncategorized/square-matrix-rotation) - 原地算法
+ - `B` [跳跃游戏](src/algorithms/uncategorized/jump-game) - 回溯,、动态编程 (自上而下+自下而上) 和贪婪的例子
+ - `B` [独特(唯一) 路径](src/algorithms/uncategorized/unique-paths) - 回溯、动态编程和基于 Pascal 三角形的例子
+ - `B` [雨水收集](src/algorithms/uncategorized/rain-terraces) - 诱捕雨水问题 (动态编程和暴力版本)
+ - `B` [递归楼梯](src/algorithms/uncategorized/recursive-staircase) - 计算有共有多少种方法可以到达顶层 (4 种解题方案)
+ - `A` [八皇后问题](src/algorithms/uncategorized/n-queens)
+ - `A` [骑士巡逻](src/algorithms/uncategorized/knight-tour)
### 算法范式
算法范式是一种通用方法,基于一类算法的设计。这是比算法更高的抽象,就像算法是比计算机程序更高的抽象。
-* **BF 算法** - `查找/搜索` 所有可能性并选择最佳解决方案
- * `B` [线性搜索](src/algorithms/search/linear-search)
- * `B` [雨水收集](src/algorithms/uncategorized/rain-terraces) - 诱导雨水问题
- * `B` [递归楼梯](src/algorithms/uncategorized/recursive-staircase) - 计算有共有多少种方法可以到达顶层 (4 种解题方案)
- * `A` [最大子数列](src/algorithms/sets/maximum-subarray)
- * `A` [旅行推销员问题](src/algorithms/graph/travelling-salesman) - 尽可能以最短的路线访问每个城市并返回原始城市
- * `A` [离散傅里叶变换](src/algorithms/math/fourier-transform) - 把时间信号解析成构成它的频率
-* **贪心法** - 在当前选择最佳选项,不考虑以后情况
- * `B` [跳跃游戏](src/algorithms/uncategorized/jump-game)
- * `A` [背包问题](src/algorithms/sets/knapsack-problem)
- * `A` [戴克斯特拉算法](src/algorithms/graph/dijkstra) - 找到所有图顶点的最短路径
- * `A` [普里姆算法](src/algorithms/graph/prim) - 寻找加权无向图的最小生成树 (MST)
- * `A` [克鲁斯卡尔算法](src/algorithms/graph/kruskal) - 寻找加权无向图的最小生成树 (MST)
-* **分治法** - 将问题分成较小的部分,然后解决这些部分
- * `B` [二分查找](src/algorithms/search/binary-search)
- * `B` [汉诺塔](src/algorithms/uncategorized/hanoi-tower)
- * `B` [杨辉三角形](src/algorithms/math/pascal-triangle)
- * `B` [欧几里得算法](src/algorithms/math/euclidean-algorithm) - 计算最大公约数 (GCD)
- * `B` [归并排序](src/algorithms/sorting/merge-sort)
- * `B` [快速排序](src/algorithms/sorting/quick-sort)
- * `B` [树深度优先搜索](src/algorithms/tree/depth-first-search) (DFS)
- * `B` [图深度优先搜索](src/algorithms/graph/depth-first-search) (DFS)
- * `B` [跳跃游戏](src/algorithms/uncategorized/jump-game)
- * `B` [快速算次方](src/algorithms/math/fast-powering)
- * `A` [排列](src/algorithms/sets/permutations) (有/无重复)
- * `A` [组合](src/algorithms/sets/combinations) (有/无重复)
-* **动态编程** - 使用以前找到的子解决方案构建解决方案
- * `B` [斐波那契数](src/algorithms/math/fibonacci)
- * `B` [跳跃游戏](src/algorithms/uncategorized/jump-game)
- * `B` [独特路径](src/algorithms/uncategorized/unique-paths)
- * `B` [雨水收集](src/algorithms/uncategorized/rain-terraces) - 疏导雨水问题
- * `B` [递归楼梯](src/algorithms/uncategorized/recursive-staircase) - 计算有共有多少种方法可以到达顶层 (4 种解题方案)
- * `A` [莱温斯坦距离](src/algorithms/string/levenshtein-distance) - 两个序列之间的最小编辑距离
- * `A` [最长公共子序列](src/algorithms/sets/longest-common-subsequence) (LCS)
- * `A` [最长公共子串](src/algorithms/string/longest-common-substring)
- * `A` [最长递增子序列](src/algorithms/sets/longest-increasing-subsequence)
- * `A` [最短公共子序列](src/algorithms/sets/shortest-common-supersequence)
- * `A` [0-1背包问题](src/algorithms/sets/knapsack-problem)
- * `A` [整数拆分](src/algorithms/math/integer-partition)
- * `A` [最大子数列](src/algorithms/sets/maximum-subarray)
- * `A` [贝尔曼-福特算法](src/algorithms/graph/bellman-ford) - 找到所有图顶点的最短路径
- * `A` [弗洛伊德算法](src/algorithms/graph/floyd-warshall) - 找到所有顶点对之间的最短路径
- * `A` [正则表达式匹配](src/algorithms/string/regular-expression-matching)
-* **回溯法** - 类似于 `BF 算法` 试图产生所有可能的解决方案,但每次生成解决方案测试如果它满足所有条件,那么只有继续生成后续解决方案。否则回溯并继续寻找不同路径的解决方案。
- * `B` [跳跃游戏](src/algorithms/uncategorized/jump-game)
- * `B` [独特路径](src/algorithms/uncategorized/unique-paths)
- * `A` [幂集](src/algorithms/sets/power-set) - 该集合的所有子集
- * `A` [哈密顿图](src/algorithms/graph/hamiltonian-cycle) - 恰好访问每个顶点一次
- * `A` [八皇后问题](src/algorithms/uncategorized/n-queens)
- * `A` [骑士巡逻](src/algorithms/uncategorized/knight-tour)
- * `A` [组合求和](src/algorithms/sets/combination-sum) - 从规定的总和中找出所有的组合
-* **Branch & Bound** - 记住在回溯搜索的每个阶段找到的成本最低的解决方案,并使用到目前为止找到的成本最小值作为下限。以便丢弃成本大于最小值的解决方案。通常,使用 BFS 遍历以及状态空间树的 DFS 遍历。
+- **BF 算法** - `查找/搜索` 所有可能性并选择最佳解决方案
+ - `B` [线性搜索](src/algorithms/search/linear-search)
+ - `B` [雨水收集](src/algorithms/uncategorized/rain-terraces) - 诱导雨水问题
+ - `B` [递归楼梯](src/algorithms/uncategorized/recursive-staircase) - 计算有共有多少种方法可以到达顶层 (4 种解题方案)
+ - `A` [最大子数列](src/algorithms/sets/maximum-subarray)
+ - `A` [旅行推销员问题](src/algorithms/graph/travelling-salesman) - 尽可能以最短的路线访问每个城市并返回原始城市
+ - `A` [离散傅里叶变换](src/algorithms/math/fourier-transform) - 把时间信号解析成构成它的频率
+- **贪心法** - 在当前选择最佳选项,不考虑以后情况
+ - `B` [跳跃游戏](src/algorithms/uncategorized/jump-game)
+ - `A` [背包问题](src/algorithms/sets/knapsack-problem)
+ - `A` [戴克斯特拉算法](src/algorithms/graph/dijkstra) - 找到所有图顶点的最短路径
+ - `A` [普里姆算法](src/algorithms/graph/prim) - 寻找加权无向图的最小生成树 (MST)
+ - `A` [克鲁斯卡尔算法](src/algorithms/graph/kruskal) - 寻找加权无向图的最小生成树 (MST)
+- **分治法** - 将问题分成较小的部分,然后解决这些部分
+ - `B` [二分查找](src/algorithms/search/binary-search)
+ - `B` [汉诺塔](src/algorithms/uncategorized/hanoi-tower)
+ - `B` [杨辉三角形](src/algorithms/math/pascal-triangle)
+ - `B` [欧几里得算法](src/algorithms/math/euclidean-algorithm) - 计算最大公约数 (GCD)
+ - `B` [归并排序](src/algorithms/sorting/merge-sort)
+ - `B` [快速排序](src/algorithms/sorting/quick-sort)
+ - `B` [树深度优先搜索](src/algorithms/tree/depth-first-search) (DFS)
+ - `B` [图深度优先搜索](src/algorithms/graph/depth-first-search) (DFS)
+ - `B` [跳跃游戏](src/algorithms/uncategorized/jump-game)
+ - `B` [快速算次方](src/algorithms/math/fast-powering)
+ - `A` [排列](src/algorithms/sets/permutations) (有/无重复)
+ - `A` [组合](src/algorithms/sets/combinations) (有/无重复)
+- **动态编程** - 使用以前找到的子解决方案构建解决方案
+ - `B` [斐波那契数](src/algorithms/math/fibonacci)
+ - `B` [跳跃游戏](src/algorithms/uncategorized/jump-game)
+ - `B` [独特路径](src/algorithms/uncategorized/unique-paths)
+ - `B` [雨水收集](src/algorithms/uncategorized/rain-terraces) - 疏导雨水问题
+ - `B` [递归楼梯](src/algorithms/uncategorized/recursive-staircase) - 计算有共有多少种方法可以到达顶层 (4 种解题方案)
+ - `A` [莱温斯坦距离](src/algorithms/string/levenshtein-distance) - 两个序列之间的最小编辑距离
+ - `A` [最长公共子序列](src/algorithms/sets/longest-common-subsequence) (LCS)
+ - `A` [最长公共子串](src/algorithms/string/longest-common-substring)
+ - `A` [最长递增子序列](src/algorithms/sets/longest-increasing-subsequence)
+ - `A` [最短公共子序列](src/algorithms/sets/shortest-common-supersequence)
+ - `A` [0-1 背包问题](src/algorithms/sets/knapsack-problem)
+ - `A` [整数拆分](src/algorithms/math/integer-partition)
+ - `A` [最大子数列](src/algorithms/sets/maximum-subarray)
+ - `A` [贝尔曼-福特算法](src/algorithms/graph/bellman-ford) - 找到所有图顶点的最短路径
+ - `A` [弗洛伊德算法](src/algorithms/graph/floyd-warshall) - 找到所有顶点对之间的最短路径
+ - `A` [正则表达式匹配](src/algorithms/string/regular-expression-matching)
+- **回溯法** - 类似于 `BF 算法` 试图产生所有可能的解决方案,但每次生成解决方案测试如果它满足所有条件,那么只有继续生成后续解决方案。否则回溯并继续寻找不同路径的解决方案。
+ - `B` [跳跃游戏](src/algorithms/uncategorized/jump-game)
+ - `B` [独特路径](src/algorithms/uncategorized/unique-paths)
+ - `A` [幂集](src/algorithms/sets/power-set) - 该集合的所有子集
+ - `A` [哈密顿图](src/algorithms/graph/hamiltonian-cycle) - 恰好访问每个顶点一次
+ - `A` [八皇后问题](src/algorithms/uncategorized/n-queens)
+ - `A` [骑士巡逻](src/algorithms/uncategorized/knight-tour)
+ - `A` [组合求和](src/algorithms/sets/combination-sum) - 从规定的总和中找出所有的组合
+- **Branch & Bound** - 记住在回溯搜索的每个阶段找到的成本最低的解决方案,并使用到目前为止找到的成本最小值作为下限。以便丢弃成本大于最小值的解决方案。通常,使用 BFS 遍历以及状态空间树的 DFS 遍历。
## 如何使用本仓库
**安装依赖**
+
```
npm install
```
@@ -215,6 +217,7 @@ npm test
```
**按照名称执行测试**
+
```
npm test -- 'LinkedList'
```
@@ -235,51 +238,51 @@ npm test -- 'playground'
[▶ YouTube](https://www.youtube.com/playlist?list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8)
-### 大O符号
+### 大 O 符号
-大O符号中指定的算法的增长顺序。
+大 O 符号中指定的算法的增长顺序。

源: [Big O Cheat Sheet](http://bigocheatsheet.com/).
-以下是一些最常用的 大O标记法 列表以及它们与不同大小输入数据的性能比较。
+以下是一些最常用的 大 O 标记法 列表以及它们与不同大小输入数据的性能比较。
-| 大O标记法 | 计算10个元素 | 计算100个元素 | 计算1000个元素 |
-| -------------- | ---------------------------- | ----------------------------- | ------------------------------- |
-| **O(1)** | 1 | 1 | 1 |
-| **O(log N)** | 3 | 6 | 9 |
-| **O(N)** | 10 | 100 | 1000 |
-| **O(N log N)** | 30 | 600 | 9000 |
-| **O(N^2)** | 100 | 10000 | 1000000 |
-| **O(2^N)** | 1024 | 1.26e+29 | 1.07e+301 |
-| **O(N!)** | 3628800 | 9.3e+157 | 4.02e+2567 |
+| 大 O 标记法 | 计算 10 个元素 | 计算 100 个元素 | 计算 1000 个元素 |
+| -------------- | -------------- | --------------- | ---------------- |
+| **O(1)** | 1 | 1 | 1 |
+| **O(log N)** | 3 | 6 | 9 |
+| **O(N)** | 10 | 100 | 1000 |
+| **O(N log N)** | 30 | 600 | 9000 |
+| **O(N^2)** | 100 | 10000 | 1000000 |
+| **O(2^N)** | 1024 | 1.26e+29 | 1.07e+301 |
+| **O(N!)** | 3628800 | 9.3e+157 | 4.02e+2567 |
### 数据结构操作的复杂性
-| 数据结构 | 连接 | 查找 | 插入 | 删除 | 备注 |
-| -------------- | :----: | :----: | :----: | :----: | ---- |
-| **数组** | 1 | n | n | n | |
-| **栈** | n | n | 1 | 1 | |
-| **队列** | n | n | 1 | 1 | |
-| **链表** | n | n | 1 | 1 | |
+| 数据结构 | 连接 | 查找 | 插入 | 删除 | 备注 |
+| -------------- | :----: | :----: | :----: | :----: | ------------------------------------ |
+| **数组** | 1 | n | n | n | |
+| **栈** | n | n | 1 | 1 | |
+| **队列** | n | n | 1 | 1 | |
+| **链表** | n | n | 1 | 1 | |
| **哈希表** | - | n | n | n | 在完全哈希函数情况下,复杂度是 O(1) |
-| **二分查找树** | 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) | |
-| **布隆过滤器** | - | 1 | 1 | - | 存在一定概率的判断错误(误判成存在) |
+| **二分查找树** | 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) | |
+| **布隆过滤器** | - | 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 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 | 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 的升序 |
diff --git a/README.zh-TW.md b/README.zh-TW.md
index 8af7e1fae6..d39c7b6adf 100644
--- a/README.zh-TW.md
+++ b/README.zh-TW.md
@@ -4,7 +4,7 @@
[](https://codecov.io/gh/trekhleb/javascript-algorithms)
這個知識庫包含許多 JavaScript 的資料結構與演算法的基礎範例。
-每個演算法和資料結構都有其個別的文件,內有相關的解釋以及更多相關的文章或Youtube影片連結。
+每個演算法和資料結構都有其個別的文件,內有相關的解釋以及更多相關的文章或 Youtube 影片連結。
_Read this in other languages:_
[_English_](https://github.com/trekhleb/javascript-algorithms/),
@@ -14,25 +14,26 @@ _Read this in other languages:_
[_Polski_](README.pl-PL.md),
[_Français_](README.fr-FR.md),
[_Español_](README.es-ES.md),
-[_Português_](README.pt-BR.md)
+[_Português_](README.pt-BR.md),
+[_Русский_](README.ru-RU.md)
## 資料結構
資料結構是一個電腦用來組織和排序資料的特定方式,透過這樣的方式資料可以有效率地被讀取以及修改。更精確地說,一個資料結構是一個資料值的集合、彼此間的關係,函數或者運作可以應用於資料上。
-* [鏈結串列](src/data-structures/linked-list)
-* [貯列](src/data-structures/queue)
-* [堆疊](src/data-structures/stack)
-* [雜湊表](src/data-structures/hash-table)
-* [堆](src/data-structures/heap)
-* [優先貯列](src/data-structures/priority-queue)
-* [字典樹](src/data-structures/trie)
-* [樹](src/data-structures/tree)
- * [二元搜尋樹](src/data-structures/tree/binary-search-tree)
- * [AVL樹](src/data-structures/tree/avl-tree)
- * [紅黑樹](src/data-structures/tree/red-black-tree)
-* [圖](src/data-structures/graph) (有向跟無向皆包含)
-* [互斥集](src/data-structures/disjoint-set)
+- [鏈結串列](src/data-structures/linked-list)
+- [貯列](src/data-structures/queue)
+- [堆疊](src/data-structures/stack)
+- [雜湊表](src/data-structures/hash-table)
+- [堆](src/data-structures/heap)
+- [優先貯列](src/data-structures/priority-queue)
+- [字典樹](src/data-structures/trie)
+- [樹](src/data-structures/tree)
+ - [二元搜尋樹](src/data-structures/tree/binary-search-tree)
+ - [AVL 樹](src/data-structures/tree/avl-tree)
+ - [紅黑樹](src/data-structures/tree/red-black-tree)
+- [圖](src/data-structures/graph) (有向跟無向皆包含)
+- [互斥集](src/data-structures/disjoint-set)
## 演算法
@@ -40,102 +41,102 @@ _Read this in other languages:_
### 演算法議題分類
-* **數學類**
- * [階層](src/algorithms/math/factorial)
- * [費伯納西數列](src/algorithms/math/fibonacci)
- * [Primality Test](src/algorithms/math/primality-test) (排除法)
- * [歐幾里得算法](src/algorithms/math/euclidean-algorithm) - 計算最大公因數 (GCD)
- * [最小公倍數](src/algorithms/math/least-common-multiple) (LCM)
- * [整數拆分](src/algorithms/math/integer-partition)
-* **集合**
- * [笛卡爾積](src/algorithms/sets/cartesian-product) - 多個集合的乘積
- * [冪集合](src/algorithms/sets/power-set) - 所有集合的子集合
- * [排列](src/algorithms/sets/permutations) (有/無重複)
- * [组合](src/algorithms/sets/combinations) (有/無重複)
- * [洗牌算法](src/algorithms/sets/fisher-yates) - 隨機置換一有限序列
- * [最長共同子序列](src/algorithms/sets/longest-common-subsequence) (LCS)
- * [最長遞增子序列](src/algorithms/sets/longest-increasing-subsequence)
- * [Shortest Common Supersequence](src/algorithms/sets/shortest-common-supersequence) (SCS)
- * [背包問題](src/algorithms/sets/knapsack-problem) - "0/1" and "Unbound" ones
- * [最大子序列問題](src/algorithms/sets/maximum-subarray) - 暴力法以及動態編程的(Kadane's)版本
-* **字串**
- * [萊文斯坦距離](src/algorithms/string/levenshtein-distance) - 兩序列間的最小編輯距離
- * [漢明距離](src/algorithms/string/hamming-distance) - number of positions at which the symbols are different
- * [KMP 演算法](src/algorithms/string/knuth-morris-pratt) - 子字串搜尋
- * [Rabin Karp 演算法](src/algorithms/string/rabin-karp) - 子字串搜尋
- * [最長共通子序列](src/algorithms/string/longest-common-substring)
-* **搜尋**
- * [二元搜尋](src/algorithms/search/binary-search)
-* **排序**
- * [氣泡排序](src/algorithms/sorting/bubble-sort)
- * [選擇排序](src/algorithms/sorting/selection-sort)
- * [插入排序](src/algorithms/sorting/insertion-sort)
- * [堆排序](src/algorithms/sorting/heap-sort)
- * [合併排序](src/algorithms/sorting/merge-sort)
- * [快速排序](src/algorithms/sorting/quick-sort)
- * [希爾排序](src/algorithms/sorting/shell-sort)
-* **樹**
- * [深度優先搜尋](src/algorithms/tree/depth-first-search) (DFS)
- * [廣度優先搜尋](src/algorithms/tree/breadth-first-search) (BFS)
-* **圖**
- * [深度優先搜尋](src/algorithms/graph/depth-first-search) (DFS)
- * [廣度優先搜尋](src/algorithms/graph/breadth-first-search) (BFS)
- * [Dijkstra 演算法](src/algorithms/graph/dijkstra) - 找到所有圖頂點的最短路徑
- * [Bellman-Ford 演算法](src/algorithms/graph/bellman-ford) - 找到所有圖頂點的最短路徑
- * [Detect Cycle](src/algorithms/graph/detect-cycle) - for both directed and undirected graphs (DFS and Disjoint Set based versions)
- * [Prim’s 演算法](src/algorithms/graph/prim) - finding Minimum Spanning Tree (MST) for weighted undirected graph
- * [Kruskal’s 演算法](src/algorithms/graph/kruskal) - finding Minimum Spanning Tree (MST) for weighted undirected graph
- * [拓撲排序](src/algorithms/graph/topological-sorting) - DFS method
- * [關節點](src/algorithms/graph/articulation-points) - Tarjan's algorithm (DFS based)
- * [橋](src/algorithms/graph/bridges) - DFS based algorithm
- * [尤拉路徑及尤拉環](src/algorithms/graph/eulerian-path) - Fleury's algorithm - Visit every edge exactly once
- * [漢彌爾頓環](src/algorithms/graph/hamiltonian-cycle) - Visit every vertex exactly once
- * [強連通組件](src/algorithms/graph/strongly-connected-components) - Kosaraju's algorithm
- * [旅行推銷員問題](src/algorithms/graph/travelling-salesman) - shortest possible route that visits each city and returns to the origin city
- * [Floyd-Warshall algorithm](src/algorithms/graph/floyd-warshall) - 一次循环可以找出所有頂點之间的最短路徑
-* **未分類**
- * [河內塔](src/algorithms/uncategorized/hanoi-tower)
- * [N-皇后問題](src/algorithms/uncategorized/n-queens)
- * [騎士走棋盤](src/algorithms/uncategorized/knight-tour)
+- **數學類**
+ - [階層](src/algorithms/math/factorial)
+ - [費伯納西數列](src/algorithms/math/fibonacci)
+ - [Primality Test](src/algorithms/math/primality-test) (排除法)
+ - [歐幾里得算法](src/algorithms/math/euclidean-algorithm) - 計算最大公因數 (GCD)
+ - [最小公倍數](src/algorithms/math/least-common-multiple) (LCM)
+ - [整數拆分](src/algorithms/math/integer-partition)
+- **集合**
+ - [笛卡爾積](src/algorithms/sets/cartesian-product) - 多個集合的乘積
+ - [冪集合](src/algorithms/sets/power-set) - 所有集合的子集合
+ - [排列](src/algorithms/sets/permutations) (有/無重複)
+ - [组合](src/algorithms/sets/combinations) (有/無重複)
+ - [洗牌算法](src/algorithms/sets/fisher-yates) - 隨機置換一有限序列
+ - [最長共同子序列](src/algorithms/sets/longest-common-subsequence) (LCS)
+ - [最長遞增子序列](src/algorithms/sets/longest-increasing-subsequence)
+ - [Shortest Common Supersequence](src/algorithms/sets/shortest-common-supersequence) (SCS)
+ - [背包問題](src/algorithms/sets/knapsack-problem) - "0/1" and "Unbound" ones
+ - [最大子序列問題](src/algorithms/sets/maximum-subarray) - 暴力法以及動態編程的(Kadane's)版本
+- **字串**
+ - [萊文斯坦距離](src/algorithms/string/levenshtein-distance) - 兩序列間的最小編輯距離
+ - [漢明距離](src/algorithms/string/hamming-distance) - number of positions at which the symbols are different
+ - [KMP 演算法](src/algorithms/string/knuth-morris-pratt) - 子字串搜尋
+ - [Rabin Karp 演算法](src/algorithms/string/rabin-karp) - 子字串搜尋
+ - [最長共通子序列](src/algorithms/string/longest-common-substring)
+- **搜尋**
+ - [二元搜尋](src/algorithms/search/binary-search)
+- **排序**
+ - [氣泡排序](src/algorithms/sorting/bubble-sort)
+ - [選擇排序](src/algorithms/sorting/selection-sort)
+ - [插入排序](src/algorithms/sorting/insertion-sort)
+ - [堆排序](src/algorithms/sorting/heap-sort)
+ - [合併排序](src/algorithms/sorting/merge-sort)
+ - [快速排序](src/algorithms/sorting/quick-sort)
+ - [希爾排序](src/algorithms/sorting/shell-sort)
+- **樹**
+ - [深度優先搜尋](src/algorithms/tree/depth-first-search) (DFS)
+ - [廣度優先搜尋](src/algorithms/tree/breadth-first-search) (BFS)
+- **圖**
+ - [深度優先搜尋](src/algorithms/graph/depth-first-search) (DFS)
+ - [廣度優先搜尋](src/algorithms/graph/breadth-first-search) (BFS)
+ - [Dijkstra 演算法](src/algorithms/graph/dijkstra) - 找到所有圖頂點的最短路徑
+ - [Bellman-Ford 演算法](src/algorithms/graph/bellman-ford) - 找到所有圖頂點的最短路徑
+ - [Detect Cycle](src/algorithms/graph/detect-cycle) - for both directed and undirected graphs (DFS and Disjoint Set based versions)
+ - [Prim’s 演算法](src/algorithms/graph/prim) - finding Minimum Spanning Tree (MST) for weighted undirected graph
+ - [Kruskal’s 演算法](src/algorithms/graph/kruskal) - finding Minimum Spanning Tree (MST) for weighted undirected graph
+ - [拓撲排序](src/algorithms/graph/topological-sorting) - DFS method
+ - [關節點](src/algorithms/graph/articulation-points) - Tarjan's algorithm (DFS based)
+ - [橋](src/algorithms/graph/bridges) - DFS based algorithm
+ - [尤拉路徑及尤拉環](src/algorithms/graph/eulerian-path) - Fleury's algorithm - Visit every edge exactly once
+ - [漢彌爾頓環](src/algorithms/graph/hamiltonian-cycle) - Visit every vertex exactly once
+ - [強連通組件](src/algorithms/graph/strongly-connected-components) - Kosaraju's algorithm
+ - [旅行推銷員問題](src/algorithms/graph/travelling-salesman) - shortest possible route that visits each city and returns to the origin city
+ - [Floyd-Warshall algorithm](src/algorithms/graph/floyd-warshall) - 一次循环可以找出所有頂點之间的最短路徑
+- **未分類**
+ - [河內塔](src/algorithms/uncategorized/hanoi-tower)
+ - [N-皇后問題](src/algorithms/uncategorized/n-queens)
+ - [騎士走棋盤](src/algorithms/uncategorized/knight-tour)
### 演算法範型
演算法的範型是一個泛用方法或設計一類底層演算法的方式。它是一個比演算法的概念更高階的抽象化,就像是演算法是比電腦程式更高階的抽象化。
-* **暴力法** - 尋遍所有的可能解然後選取最好的解
- * [最大子序列](src/algorithms/sets/maximum-subarray)
- * [旅行推銷員問題](src/algorithms/graph/travelling-salesman) - shortest possible route that visits each city and returns to the origin city
-* **貪婪法** - choose the best option at the current time, without any consideration for the future
- * [未定背包問題](src/algorithms/sets/knapsack-problem)
- * [Dijkstra 演算法](src/algorithms/graph/dijkstra) - 找到所有圖頂點的最短路徑
- * [Prim’s 演算法](src/algorithms/graph/prim) - finding Minimum Spanning Tree (MST) for weighted undirected graph
- * [Kruskal’s 演算法](src/algorithms/graph/kruskal) - finding Minimum Spanning Tree (MST) for weighted undirected graph
-* **分治法** - divide the problem into smaller parts and then solve those parts
- * [二元搜尋](src/algorithms/search/binary-search)
- * [河內塔](src/algorithms/uncategorized/hanoi-tower)
- * [歐幾里得演算法](src/algorithms/math/euclidean-algorithm) - calculate the Greatest Common Divisor (GCD)
- * [排列](src/algorithms/sets/permutations) (有/無重複)
- * [组合](src/algorithms/sets/combinations) (有/無重複)
- * [合併排序](src/algorithms/sorting/merge-sort)
- * [快速排序](src/algorithms/sorting/quick-sort)
- * [樹深度優先搜尋](src/algorithms/tree/depth-first-search) (DFS)
- * [圖深度優先搜尋](src/algorithms/graph/depth-first-search) (DFS)
-* **動態編程** - build up to a solution using previously found sub-solutions
- * [費伯納西數列](src/algorithms/math/fibonacci)
- * [萊溫斯坦距離](src/algorithms/string/levenshtein-distance) - minimum edit distance between two sequences
- * [最長共同子序列](src/algorithms/sets/longest-common-subsequence) (LCS)
- * [最長共同子字串](src/algorithms/string/longest-common-substring)
- * [最長遞增子序列](src/algorithms/sets/longest-increasing-subsequence)
- * [最短共同子序列](src/algorithms/sets/shortest-common-supersequence)
- * [0/1背包問題](src/algorithms/sets/knapsack-problem)
- * [整數拆分](src/algorithms/math/integer-partition)
- * [最大子序列](src/algorithms/sets/maximum-subarray)
- * [Bellman-Ford 演算法](src/algorithms/graph/bellman-ford) - finding shortest path to all graph vertices
-* **回溯法** - 用類似暴力法來嘗試產生所有可能解,但每次只在能滿足所有測試條件,且只有繼續產生子序列方案來產生的解決方案。否則回溯並尋找不同路徑的解決方案。
- * [漢彌爾頓迴路](src/algorithms/graph/hamiltonian-cycle) - Visit every vertex exactly once
- * [N-皇后問題](src/algorithms/uncategorized/n-queens)
- * [騎士走棋盤](src/algorithms/uncategorized/knight-tour)
-* **Branch & Bound**
+- **暴力法** - 尋遍所有的可能解然後選取最好的解
+ - [最大子序列](src/algorithms/sets/maximum-subarray)
+ - [旅行推銷員問題](src/algorithms/graph/travelling-salesman) - shortest possible route that visits each city and returns to the origin city
+- **貪婪法** - choose the best option at the current time, without any consideration for the future
+ - [未定背包問題](src/algorithms/sets/knapsack-problem)
+ - [Dijkstra 演算法](src/algorithms/graph/dijkstra) - 找到所有圖頂點的最短路徑
+ - [Prim’s 演算法](src/algorithms/graph/prim) - finding Minimum Spanning Tree (MST) for weighted undirected graph
+ - [Kruskal’s 演算法](src/algorithms/graph/kruskal) - finding Minimum Spanning Tree (MST) for weighted undirected graph
+- **分治法** - divide the problem into smaller parts and then solve those parts
+ - [二元搜尋](src/algorithms/search/binary-search)
+ - [河內塔](src/algorithms/uncategorized/hanoi-tower)
+ - [歐幾里得演算法](src/algorithms/math/euclidean-algorithm) - calculate the Greatest Common Divisor (GCD)
+ - [排列](src/algorithms/sets/permutations) (有/無重複)
+ - [组合](src/algorithms/sets/combinations) (有/無重複)
+ - [合併排序](src/algorithms/sorting/merge-sort)
+ - [快速排序](src/algorithms/sorting/quick-sort)
+ - [樹深度優先搜尋](src/algorithms/tree/depth-first-search) (DFS)
+ - [圖深度優先搜尋](src/algorithms/graph/depth-first-search) (DFS)
+- **動態編程** - build up to a solution using previously found sub-solutions
+ - [費伯納西數列](src/algorithms/math/fibonacci)
+ - [萊溫斯坦距離](src/algorithms/string/levenshtein-distance) - minimum edit distance between two sequences
+ - [最長共同子序列](src/algorithms/sets/longest-common-subsequence) (LCS)
+ - [最長共同子字串](src/algorithms/string/longest-common-substring)
+ - [最長遞增子序列](src/algorithms/sets/longest-increasing-subsequence)
+ - [最短共同子序列](src/algorithms/sets/shortest-common-supersequence)
+ - [0/1 背包問題](src/algorithms/sets/knapsack-problem)
+ - [整數拆分](src/algorithms/math/integer-partition)
+ - [最大子序列](src/algorithms/sets/maximum-subarray)
+ - [Bellman-Ford 演算法](src/algorithms/graph/bellman-ford) - finding shortest path to all graph vertices
+- **回溯法** - 用類似暴力法來嘗試產生所有可能解,但每次只在能滿足所有測試條件,且只有繼續產生子序列方案來產生的解決方案。否則回溯並尋找不同路徑的解決方案。
+ - [漢彌爾頓迴路](src/algorithms/graph/hamiltonian-cycle) - Visit every vertex exactly once
+ - [N-皇后問題](src/algorithms/uncategorized/n-queens)
+ - [騎士走棋盤](src/algorithms/uncategorized/knight-tour)
+- **Branch & Bound**
## 如何使用本知識庫
@@ -146,14 +147,17 @@ npm install
```
**執行所有測試**
+
```
npm test
```
**以名稱執行該測試**
+
```
npm test -- 'LinkedList'
```
+
**練習場**
你可以透過在`./src/playground/playground.js`裡面的檔案練習資料結構以及演算法,並且撰寫在`./src/playground/__test__/playground.test.js`裡面的測試程式。
@@ -180,38 +184,38 @@ npm test -- 'playground'
下列列出幾個常用的 Big O 標記以及其不同大小資料量輸入後的運算效能比較。
-| Big O 標記 | 10個資料量需花費的時間 | 100個資料量需花費的時間 | 1000個資料量需花費的時間 |
-| -------------- | ---------------------------- | ----------------------------- | ------------------------------- |
-| **O(1)** | 1 | 1 | 1 |
-| **O(log N)** | 3 | 6 | 9 |
-| **O(N)** | 10 | 100 | 1000 |
-| **O(N log N)** | 30 | 600 | 9000 |
-| **O(N^2)** | 100 | 10000 | 1000000 |
-| **O(2^N)** | 1024 | 1.26e+29 | 1.07e+301 |
-| **O(N!)** | 3628800 | 9.3e+157 | 4.02e+2567 |
+| Big O 標記 | 10 個資料量需花費的時間 | 100 個資料量需花費的時間 | 1000 個資料量需花費的時間 |
+| -------------- | ----------------------- | ------------------------ | ------------------------- |
+| **O(1)** | 1 | 1 | 1 |
+| **O(log N)** | 3 | 6 | 9 |
+| **O(N)** | 10 | 100 | 1000 |
+| **O(N log N)** | 30 | 600 | 9000 |
+| **O(N^2)** | 100 | 10000 | 1000000 |
+| **O(2^N)** | 1024 | 1.26e+29 | 1.07e+301 |
+| **O(N!)** | 3628800 | 9.3e+157 | 4.02e+2567 |
### 資料結構運作複雜度
-| 資料結構 | 存取 | 搜尋 | 插入 | 刪除 |
-| ----------------------- | :-------: | :-------: | :-------: | :-------: |
-| **陣列** | 1 | n | n | n |
-| **堆疊** | n | n | 1 | 1 |
-| **貯列** | n | n | 1 | 1 |
-| **鏈結串列** | n | n | 1 | 1 |
-| **雜湊表** | - | n | n | n |
-| **二元搜尋樹** | n | n | n | n |
-| **B-Tree** | log(n) | log(n) | log(n) | log(n) |
-| **紅黑樹** | log(n) | log(n) | log(n) | log(n) |
-| **AVL Tree** | log(n) | log(n) | log(n) | log(n) |
+| 資料結構 | 存取 | 搜尋 | 插入 | 刪除 |
+| -------------- | :----: | :----: | :----: | :----: |
+| **陣列** | 1 | n | n | n |
+| **堆疊** | n | n | 1 | 1 |
+| **貯列** | n | n | 1 | 1 |
+| **鏈結串列** | n | n | 1 | 1 |
+| **雜湊表** | - | n | n | n |
+| **二元搜尋樹** | n | n | n | n |
+| **B-Tree** | log(n) | log(n) | log(n) | log(n) |
+| **紅黑樹** | log(n) | log(n) | log(n) | log(n) |
+| **AVL Tree** | log(n) | log(n) | log(n) | log(n) |
### 陣列排序演算法複雜度
-| 名稱 | 最佳 | 平均 | 最差 | 記憶體 | 穩定 |
-| ---------------------- | :-------: | :-------: | :-----------: | :-------: | :-------: |
-| **氣派排序** | n | n^2 | n^2 | 1 | Yes |
-| **插入排序** | n | n^2 | n^2 | 1 | Yes |
-| **選擇排序** | n^2 | n^2 | n^2 | 1 | No |
-| **Heap 排序** | 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 |
-| **希爾排序** | n log(n) | 由gap sequence決定 | n (log(n))^2 | 1 | No |
+| 名稱 | 最佳 | 平均 | 最差 | 記憶體 | 穩定 |
+| ------------- | :------: | :------------------: | :----------: | :----: | :--: |
+| **氣派排序** | n | n^2 | n^2 | 1 | Yes |
+| **插入排序** | n | n^2 | n^2 | 1 | Yes |
+| **選擇排序** | n^2 | n^2 | n^2 | 1 | No |
+| **Heap 排序** | 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 |
+| **希爾排序** | n log(n) | 由 gap sequence 決定 | n (log(n))^2 | 1 | No |