Showing preview only (1,845K chars total). Download the full file or copy to clipboard to get everything.
Repository: trekhleb/javascript-algorithms
Branch: master
Commit: 115e42816808
Files: 627
Total size: 1.6 MB
Directory structure:
gitextract_7srfgao2/
├── .babelrc
├── .editorconfig
├── .eslintrc
├── .github/
│ └── workflows/
│ └── CI.yml
├── .gitignore
├── .husky/
│ └── pre-commit
├── .npmrc
├── .nvmrc
├── BACKERS.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.ar-AR.md
├── README.de-DE.md
├── README.es-ES.md
├── README.fr-FR.md
├── README.he-IL.md
├── README.id-ID.md
├── README.it-IT.md
├── README.ja-JP.md
├── README.ko-KR.md
├── README.md
├── README.pl-PL.md
├── README.pt-BR.md
├── README.ru-RU.md
├── README.tr-TR.md
├── README.uk-UA.md
├── README.uz-UZ.md
├── README.vi-VN.md
├── README.zh-CN.md
├── README.zh-TW.md
├── jest.config.js
├── package.json
└── src/
├── algorithms/
│ ├── cryptography/
│ │ ├── caesar-cipher/
│ │ │ ├── README.md
│ │ │ ├── README.ru-RU.md
│ │ │ ├── __test__/
│ │ │ │ └── caesarCipher.test.js
│ │ │ └── caesarCipher.js
│ │ ├── hill-cipher/
│ │ │ ├── README.md
│ │ │ ├── _test_/
│ │ │ │ └── hillCipher.test.js
│ │ │ └── hillCipher.js
│ │ ├── polynomial-hash/
│ │ │ ├── PolynomialHash.js
│ │ │ ├── README.md
│ │ │ ├── SimplePolynomialHash.js
│ │ │ └── __test__/
│ │ │ ├── PolynomialHash.test.js
│ │ │ └── SimplePolynomialHash.test.js
│ │ └── rail-fence-cipher/
│ │ ├── README.md
│ │ ├── __test__/
│ │ │ └── railFenceCipher.test.js
│ │ └── railFenceCipher.js
│ ├── graph/
│ │ ├── articulation-points/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── articulationPoints.test.js
│ │ │ └── articulationPoints.js
│ │ ├── bellman-ford/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── bellmanFord.test.js
│ │ │ └── bellmanFord.js
│ │ ├── breadth-first-search/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── breadthFirstSearch.test.js
│ │ │ └── breadthFirstSearch.js
│ │ ├── bridges/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── graphBridges.test.js
│ │ │ └── graphBridges.js
│ │ ├── depth-first-search/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── depthFirstSearch.test.js
│ │ │ └── depthFirstSearch.js
│ │ ├── detect-cycle/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ ├── detectDirectedCycle.test.js
│ │ │ │ ├── detectUndirectedCycle.test.js
│ │ │ │ └── detectUndirectedCycleUsingDisjointSet.test.js
│ │ │ ├── detectDirectedCycle.js
│ │ │ ├── detectUndirectedCycle.js
│ │ │ └── detectUndirectedCycleUsingDisjointSet.js
│ │ ├── dijkstra/
│ │ │ ├── README.de-DE.md
│ │ │ ├── README.es-ES.md
│ │ │ ├── README.fr-FR.md
│ │ │ ├── README.he-IL.md
│ │ │ ├── README.ja-JP.md
│ │ │ ├── README.ko-KR.md
│ │ │ ├── README.md
│ │ │ ├── README.uk-UA.md
│ │ │ ├── README.zh-CN.md
│ │ │ ├── README.zh-TW.md
│ │ │ ├── __test__/
│ │ │ │ └── dijkstra.test.js
│ │ │ └── dijkstra.js
│ │ ├── eulerian-path/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── eulerianPath.test.js
│ │ │ └── eulerianPath.js
│ │ ├── floyd-warshall/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── floydWarshall.test.js
│ │ │ └── floydWarshall.js
│ │ ├── hamiltonian-cycle/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── hamiltonianCycle.test.js
│ │ │ └── hamiltonianCycle.js
│ │ ├── kruskal/
│ │ │ ├── README.ko-KR.md
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── kruskal.test.js
│ │ │ └── kruskal.js
│ │ ├── prim/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── prim.test.js
│ │ │ └── prim.js
│ │ ├── strongly-connected-components/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── stronglyConnectedComponents.test.js
│ │ │ └── stronglyConnectedComponents.js
│ │ ├── topological-sorting/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── topologicalSort.test.js
│ │ │ └── topologicalSort.js
│ │ └── travelling-salesman/
│ │ ├── README.md
│ │ ├── __test__/
│ │ │ └── bfTravellingSalesman.test.js
│ │ └── bfTravellingSalesman.js
│ ├── image-processing/
│ │ ├── seam-carving/
│ │ │ ├── README.md
│ │ │ ├── README.ru-RU.md
│ │ │ ├── __tests__/
│ │ │ │ └── resizeImageWidth.node.js
│ │ │ └── resizeImageWidth.js
│ │ └── utils/
│ │ └── imageData.js
│ ├── linked-list/
│ │ ├── reverse-traversal/
│ │ │ ├── README.md
│ │ │ ├── README.pt-BR.md
│ │ │ ├── README.zh-CN.md
│ │ │ ├── __test__/
│ │ │ │ └── reverseTraversal.test.js
│ │ │ └── reverseTraversal.js
│ │ └── traversal/
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── README.ru-RU.md
│ │ ├── README.zh-CN.md
│ │ ├── __test__/
│ │ │ └── traversal.test.js
│ │ └── traversal.js
│ ├── math/
│ │ ├── binary-floating-point/
│ │ │ ├── README.md
│ │ │ ├── __tests__/
│ │ │ │ ├── bitsToFloat.test.js
│ │ │ │ └── floatAsBinaryString.test.js
│ │ │ ├── bitsToFloat.js
│ │ │ ├── floatAsBinaryString.js
│ │ │ └── testCases.js
│ │ ├── bits/
│ │ │ ├── README.fr-FR.md
│ │ │ ├── README.md
│ │ │ ├── README.zh-CN.md
│ │ │ ├── __test__/
│ │ │ │ ├── bitLength.test.js
│ │ │ │ ├── bitsDiff.test.js
│ │ │ │ ├── clearBit.test.js
│ │ │ │ ├── countSetBits.test.js
│ │ │ │ ├── divideByTwo.test.js
│ │ │ │ ├── fullAdder.test.js
│ │ │ │ ├── getBit.test.js
│ │ │ │ ├── isEven.test.js
│ │ │ │ ├── isPositive.test.js
│ │ │ │ ├── isPowerOfTwo.test.js
│ │ │ │ ├── multiply.test.js
│ │ │ │ ├── multiplyByTwo.test.js
│ │ │ │ ├── multiplyUnsigned.test.js
│ │ │ │ ├── setBit.test.js
│ │ │ │ ├── switchSign.test.js
│ │ │ │ └── updateBit.test.js
│ │ │ ├── bitLength.js
│ │ │ ├── bitsDiff.js
│ │ │ ├── clearBit.js
│ │ │ ├── countSetBits.js
│ │ │ ├── divideByTwo.js
│ │ │ ├── fullAdder.js
│ │ │ ├── getBit.js
│ │ │ ├── isEven.js
│ │ │ ├── isPositive.js
│ │ │ ├── isPowerOfTwo.js
│ │ │ ├── multiply.js
│ │ │ ├── multiplyByTwo.js
│ │ │ ├── multiplyUnsigned.js
│ │ │ ├── setBit.js
│ │ │ ├── switchSign.js
│ │ │ └── updateBit.js
│ │ ├── complex-number/
│ │ │ ├── ComplexNumber.js
│ │ │ ├── README.fr-FR.md
│ │ │ ├── README.md
│ │ │ └── __test__/
│ │ │ └── ComplexNumber.test.js
│ │ ├── euclidean-algorithm/
│ │ │ ├── README.fr-FR.md
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ ├── euclideanAlgorithm.test.js
│ │ │ │ └── euclideanAlgorithmIterative.test.js
│ │ │ ├── euclideanAlgorithm.js
│ │ │ └── euclideanAlgorithmIterative.js
│ │ ├── euclidean-distance/
│ │ │ ├── README.md
│ │ │ ├── __tests__/
│ │ │ │ └── euclideanDistance.test.js
│ │ │ └── euclideanDistance.js
│ │ ├── factorial/
│ │ │ ├── README.fr-FR.md
│ │ │ ├── README.ka-GE.md
│ │ │ ├── README.md
│ │ │ ├── README.tr-TR.md
│ │ │ ├── README.uk-UA.md
│ │ │ ├── README.zh-CN.md
│ │ │ ├── __test__/
│ │ │ │ ├── factorial.test.js
│ │ │ │ └── factorialRecursive.test.js
│ │ │ ├── factorial.js
│ │ │ └── factorialRecursive.js
│ │ ├── fast-powering/
│ │ │ ├── README.fr-FR.md
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── fastPowering.test.js
│ │ │ └── fastPowering.js
│ │ ├── fibonacci/
│ │ │ ├── README.fr-FR.md
│ │ │ ├── README.ka-GE.md
│ │ │ ├── README.md
│ │ │ ├── README.zh-CN.md
│ │ │ ├── __test__/
│ │ │ │ ├── fibonacci.test.js
│ │ │ │ ├── fibonacciNth.test.js
│ │ │ │ └── fibonacciNthClosedForm.test.js
│ │ │ ├── fibonacci.js
│ │ │ ├── fibonacciNth.js
│ │ │ └── fibonacciNthClosedForm.js
│ │ ├── fourier-transform/
│ │ │ ├── README.fr-FR.md
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ ├── FourierTester.js
│ │ │ │ ├── discreteFourierTransform.test.js
│ │ │ │ ├── fastFourierTransform.test.js
│ │ │ │ └── inverseDiscreteFourierTransform.test.js
│ │ │ ├── discreteFourierTransform.js
│ │ │ ├── fastFourierTransform.js
│ │ │ └── inverseDiscreteFourierTransform.js
│ │ ├── horner-method/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ ├── classicPolynome.test.js
│ │ │ │ └── hornerMethod.test.js
│ │ │ ├── classicPolynome.js
│ │ │ └── hornerMethod.js
│ │ ├── integer-partition/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── integerPartition.test.js
│ │ │ └── integerPartition.js
│ │ ├── is-power-of-two/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ ├── isPowerOfTwo.test.js
│ │ │ │ └── isPowerOfTwoBitwise.test.js
│ │ │ ├── isPowerOfTwo.js
│ │ │ └── isPowerOfTwoBitwise.js
│ │ ├── least-common-multiple/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── leastCommonMultiple.test.js
│ │ │ └── leastCommonMultiple.js
│ │ ├── liu-hui/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── liuHui.test.js
│ │ │ └── liuHui.js
│ │ ├── matrix/
│ │ │ ├── Matrix.js
│ │ │ ├── README.md
│ │ │ └── __tests__/
│ │ │ └── Matrix.test.js
│ │ ├── pascal-triangle/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ ├── pascalTriangle.test.js
│ │ │ │ └── pascalTriangleRecursive.test.js
│ │ │ ├── pascalTriangle.js
│ │ │ └── pascalTriangleRecursive.js
│ │ ├── primality-test/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── trialDivision.test.js
│ │ │ └── trialDivision.js
│ │ ├── prime-factors/
│ │ │ ├── README.md
│ │ │ ├── README.zh-CN.md
│ │ │ ├── __test__/
│ │ │ │ └── primeFactors.test.js
│ │ │ └── primeFactors.js
│ │ ├── radian/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ ├── degreeToRadian.test.js
│ │ │ │ └── radianToDegree.test.js
│ │ │ ├── degreeToRadian.js
│ │ │ └── radianToDegree.js
│ │ ├── sieve-of-eratosthenes/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── sieveOfEratosthenes.test.js
│ │ │ └── sieveOfEratosthenes.js
│ │ └── square-root/
│ │ ├── README.md
│ │ ├── __test__/
│ │ │ └── squareRoot.test.js
│ │ └── squareRoot.js
│ ├── ml/
│ │ ├── k-means/
│ │ │ ├── README.md
│ │ │ ├── README.pt-BR.md
│ │ │ ├── __test__/
│ │ │ │ └── kMeans.test.js
│ │ │ └── kMeans.js
│ │ └── knn/
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── __test__/
│ │ │ └── knn.test.js
│ │ └── kNN.js
│ ├── search/
│ │ ├── binary-search/
│ │ │ ├── README.es-ES.md
│ │ │ ├── README.md
│ │ │ ├── README.pt-BR.md
│ │ │ ├── __test__/
│ │ │ │ └── binarySearch.test.js
│ │ │ └── binarySearch.js
│ │ ├── interpolation-search/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── interpolationSearch.test.js
│ │ │ └── interpolationSearch.js
│ │ ├── jump-search/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── jumpSearch.test.js
│ │ │ └── jumpSearch.js
│ │ └── linear-search/
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── __test__/
│ │ │ └── linearSearch.test.js
│ │ └── linearSearch.js
│ ├── sets/
│ │ ├── cartesian-product/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── cartesianProduct.test.js
│ │ │ └── cartesianProduct.js
│ │ ├── combination-sum/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── combinationSum.test.js
│ │ │ └── combinationSum.js
│ │ ├── combinations/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ ├── combineWithRepetitions.test.js
│ │ │ │ └── combineWithoutRepetitions.test.js
│ │ │ ├── combineWithRepetitions.js
│ │ │ └── combineWithoutRepetitions.js
│ │ ├── fisher-yates/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── fisherYates.test.js
│ │ │ └── fisherYates.js
│ │ ├── knapsack-problem/
│ │ │ ├── Knapsack.js
│ │ │ ├── KnapsackItem.js
│ │ │ ├── README.md
│ │ │ └── __test__/
│ │ │ ├── Knapsack.test.js
│ │ │ └── KnapsackItem.test.js
│ │ ├── longest-common-subsequence/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ ├── longestCommonSubsequence.test.js
│ │ │ │ └── longestCommonSubsequenceRecursive.test.js
│ │ │ ├── longestCommonSubsequence.js
│ │ │ └── longestCommonSubsequenceRecursive.js
│ │ ├── longest-increasing-subsequence/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── dpLongestIncreasingSubsequence.test.js
│ │ │ └── dpLongestIncreasingSubsequence.js
│ │ ├── maximum-subarray/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ ├── bfMaximumSubarray.test.js
│ │ │ │ ├── dcMaximumSubarraySum.test.js
│ │ │ │ └── dpMaximumSubarray.test.js
│ │ │ ├── bfMaximumSubarray.js
│ │ │ ├── dcMaximumSubarraySum.js
│ │ │ └── dpMaximumSubarray.js
│ │ ├── permutations/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ ├── permutateWithRepetitions.test.js
│ │ │ │ └── permutateWithoutRepetitions.test.js
│ │ │ ├── permutateWithRepetitions.js
│ │ │ └── permutateWithoutRepetitions.js
│ │ ├── power-set/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ ├── btPowerSet.test.js
│ │ │ │ ├── bwPowerSet.test.js
│ │ │ │ └── caPowerSet.test.js
│ │ │ ├── btPowerSet.js
│ │ │ ├── bwPowerSet.js
│ │ │ └── caPowerSet.js
│ │ └── shortest-common-supersequence/
│ │ ├── README.md
│ │ ├── __test__/
│ │ │ └── shortestCommonSupersequence.test.js
│ │ └── shortestCommonSupersequence.js
│ ├── sorting/
│ │ ├── Sort.js
│ │ ├── SortTester.js
│ │ ├── __test__/
│ │ │ └── Sort.test.js
│ │ ├── bubble-sort/
│ │ │ ├── BubbleSort.js
│ │ │ ├── README.md
│ │ │ ├── README.pt-BR.md
│ │ │ └── __test__/
│ │ │ └── BubbleSort.test.js
│ │ ├── bucket-sort/
│ │ │ ├── BucketSort.js
│ │ │ ├── README.md
│ │ │ └── __test__/
│ │ │ └── BucketSort.test.js
│ │ ├── counting-sort/
│ │ │ ├── CountingSort.js
│ │ │ ├── README.md
│ │ │ ├── README.pt-br.md
│ │ │ └── __test__/
│ │ │ └── CountingSort.test.js
│ │ ├── heap-sort/
│ │ │ ├── HeapSort.js
│ │ │ ├── README.md
│ │ │ ├── README.pt-BR.md
│ │ │ └── __test__/
│ │ │ └── HeapSort.test.js
│ │ ├── insertion-sort/
│ │ │ ├── InsertionSort.js
│ │ │ ├── README.md
│ │ │ ├── README.pt-BR.md
│ │ │ └── __test__/
│ │ │ └── InsertionSort.test.js
│ │ ├── merge-sort/
│ │ │ ├── MergeSort.js
│ │ │ ├── README.ko-KR.md
│ │ │ ├── README.md
│ │ │ ├── README.pt-BR.md
│ │ │ └── __test__/
│ │ │ └── MergeSort.test.js
│ │ ├── quick-sort/
│ │ │ ├── QuickSort.js
│ │ │ ├── QuickSortInPlace.js
│ │ │ ├── README.md
│ │ │ ├── README.pt-BR.md
│ │ │ ├── README.zh-CN.md
│ │ │ └── __test__/
│ │ │ ├── QuickSort.test.js
│ │ │ └── QuickSortInPlace.test.js
│ │ ├── radix-sort/
│ │ │ ├── README.md
│ │ │ ├── README.pt-BR.md
│ │ │ ├── RadixSort.js
│ │ │ └── __test__/
│ │ │ └── RadixSort.test.js
│ │ ├── selection-sort/
│ │ │ ├── README.md
│ │ │ ├── README.pt-BR.md
│ │ │ ├── SelectionSort.js
│ │ │ └── __test__/
│ │ │ └── SelectionSort.test.js
│ │ └── shell-sort/
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── ShellSort.js
│ │ └── __test__/
│ │ └── ShellSort.test.js
│ ├── stack/
│ │ └── valid-parentheses/
│ │ ├── README.md
│ │ ├── __test__/
│ │ │ └── validParentheses.test.js
│ │ └── validParentheses.js
│ ├── statistics/
│ │ └── weighted-random/
│ │ ├── README.md
│ │ ├── __test__/
│ │ │ └── weightedRandom.test.js
│ │ └── weightedRandom.js
│ ├── string/
│ │ ├── hamming-distance/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── hammingDistance.test.js
│ │ │ └── hammingDistance.js
│ │ ├── knuth-morris-pratt/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── knuthMorrisPratt.test.js
│ │ │ └── knuthMorrisPratt.js
│ │ ├── levenshtein-distance/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── levenshteinDistance.test.js
│ │ │ └── levenshteinDistance.js
│ │ ├── longest-common-substring/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── longestCommonSubstring.test.js
│ │ │ └── longestCommonSubstring.js
│ │ ├── palindrome/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── isPalindrome.test.js
│ │ │ └── isPalindrome.js
│ │ ├── rabin-karp/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── rabinKarp.test.js
│ │ │ └── rabinKarp.js
│ │ ├── regular-expression-matching/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── regularExpressionMatching.test.js
│ │ │ └── regularExpressionMatching.js
│ │ └── z-algorithm/
│ │ ├── README.md
│ │ ├── __test__/
│ │ │ └── zAlgorithm.test.js
│ │ └── zAlgorithm.js
│ ├── tree/
│ │ ├── breadth-first-search/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── breadthFirstSearch.test.js
│ │ │ └── breadthFirstSearch.js
│ │ └── depth-first-search/
│ │ ├── README.md
│ │ ├── __test__/
│ │ │ └── depthFirstSearch.test.js
│ │ └── depthFirstSearch.js
│ └── uncategorized/
│ ├── best-time-to-buy-sell-stocks/
│ │ ├── README.md
│ │ ├── __tests__/
│ │ │ ├── accumulatorBestTimeToBuySellStocks.test.js
│ │ │ ├── dpBestTimeToBuySellStocks.test.js
│ │ │ ├── dqBestTimeToBuySellStocks.test.js
│ │ │ └── peakvalleyBestTimeToBuySellStocks.test.js
│ │ ├── accumulatorBestTimeToBuySellStocks.js
│ │ ├── dpBestTimeToBuySellStocks.js
│ │ ├── dqBestTimeToBuySellStocks.js
│ │ └── peakvalleyBestTimeToBuySellStocks.js
│ ├── hanoi-tower/
│ │ ├── README.md
│ │ ├── __test__/
│ │ │ └── hanoiTower.test.js
│ │ └── hanoiTower.js
│ ├── jump-game/
│ │ ├── README.md
│ │ ├── __test__/
│ │ │ ├── backtrackingJumpGame.test.js
│ │ │ ├── dpBottomUpJumpGame.test.js
│ │ │ ├── dpTopDownJumpGame.test.js
│ │ │ └── greedyJumpGame.test.js
│ │ ├── backtrackingJumpGame.js
│ │ ├── dpBottomUpJumpGame.js
│ │ ├── dpTopDownJumpGame.js
│ │ └── greedyJumpGame.js
│ ├── knight-tour/
│ │ ├── README.md
│ │ ├── __test__/
│ │ │ └── knightTour.test.js
│ │ └── knightTour.js
│ ├── n-queens/
│ │ ├── QueenPosition.js
│ │ ├── README.md
│ │ ├── __test__/
│ │ │ ├── QueensPosition.test.js
│ │ │ ├── nQueens.test.js
│ │ │ └── nQueensBitwise.test.js
│ │ ├── nQueens.js
│ │ └── nQueensBitwise.js
│ ├── rain-terraces/
│ │ ├── README.md
│ │ ├── __test__/
│ │ │ ├── bfRainTerraces.test.js
│ │ │ └── dpRainTerraces.test.js
│ │ ├── bfRainTerraces.js
│ │ └── dpRainTerraces.js
│ ├── recursive-staircase/
│ │ ├── README.md
│ │ ├── __test__/
│ │ │ ├── recursiveStaircaseBF.test.js
│ │ │ ├── recursiveStaircaseDP.test.js
│ │ │ ├── recursiveStaircaseIT.test.js
│ │ │ └── recursiveStaircaseMEM.test.js
│ │ ├── recursiveStaircaseBF.js
│ │ ├── recursiveStaircaseDP.js
│ │ ├── recursiveStaircaseIT.js
│ │ └── recursiveStaircaseMEM.js
│ ├── square-matrix-rotation/
│ │ ├── README.md
│ │ ├── __test__/
│ │ │ └── squareMatrixRotation.test.js
│ │ └── squareMatrixRotation.js
│ └── unique-paths/
│ ├── README.md
│ ├── __test__/
│ │ ├── btUniquePaths.test.js
│ │ ├── dpUniquePaths.test.js
│ │ └── uniquePaths.test.js
│ ├── btUniquePaths.js
│ ├── dpUniquePaths.js
│ └── uniquePaths.js
├── data-structures/
│ ├── bloom-filter/
│ │ ├── BloomFilter.js
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── README.ru-RU.md
│ │ ├── README.uk-UA.md
│ │ └── __test__/
│ │ └── BloomFilter.test.js
│ ├── disjoint-set/
│ │ ├── DisjointSet.js
│ │ ├── DisjointSetAdhoc.js
│ │ ├── DisjointSetItem.js
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── README.ru-RU.md
│ │ ├── README.uk-UA.md
│ │ └── __test__/
│ │ ├── DisjointSet.test.js
│ │ ├── DisjointSetAdhoc.test.js
│ │ └── DisjointSetItem.test.js
│ ├── doubly-linked-list/
│ │ ├── DoublyLinkedList.js
│ │ ├── DoublyLinkedListNode.js
│ │ ├── README.es-ES.md
│ │ ├── README.ja-JP.md
│ │ ├── README.ko-KR.md
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── README.ru-RU.md
│ │ ├── README.uk-UA.md
│ │ ├── README.zh-CN.md
│ │ └── __test__/
│ │ ├── DoublyLinkedList.test.js
│ │ └── DoublyLinkedListNode.test.js
│ ├── graph/
│ │ ├── Graph.js
│ │ ├── GraphEdge.js
│ │ ├── GraphVertex.js
│ │ ├── README.fr-FR.md
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── README.ru-RU.md
│ │ ├── README.uk-UA.md
│ │ ├── README.zh-CN.md
│ │ └── __test__/
│ │ ├── Graph.test.js
│ │ ├── GraphEdge.test.js
│ │ └── GraphVertex.test.js
│ ├── hash-table/
│ │ ├── HashTable.js
│ │ ├── README.fr-FR.md
│ │ ├── README.ja-JP.md
│ │ ├── README.ko-KR.md
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── README.ru-RU.md
│ │ ├── README.uk-UA.md
│ │ ├── README.zh-CN.md
│ │ └── __test__/
│ │ └── HashTable.test.js
│ ├── heap/
│ │ ├── Heap.js
│ │ ├── MaxHeap.js
│ │ ├── MaxHeapAdhoc.js
│ │ ├── MinHeap.js
│ │ ├── MinHeapAdhoc.js
│ │ ├── README.fr-FR.md
│ │ ├── README.ja-JP.md
│ │ ├── README.ko-KR.md
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── README.ru-RU.md
│ │ ├── README.tr-TR.md
│ │ ├── README.uk-UA.md
│ │ ├── README.zh-CN.md
│ │ └── __test__/
│ │ ├── Heap.test.js
│ │ ├── MaxHeap.test.js
│ │ ├── MaxHeapAdhoc.test.js
│ │ ├── MinHeap.test.js
│ │ └── MinHeapAdhoc.test.js
│ ├── linked-list/
│ │ ├── LinkedList.js
│ │ ├── LinkedListNode.js
│ │ ├── README.es-ES.md
│ │ ├── README.ja-JP.md
│ │ ├── README.ko-KR.md
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── README.ru-RU.md
│ │ ├── README.tr-TR.md
│ │ ├── README.uk-UA.md
│ │ ├── README.vi-VN.md
│ │ ├── README.zh-CN.md
│ │ └── __test__/
│ │ ├── LinkedList.test.js
│ │ └── LinkedListNode.test.js
│ ├── lru-cache/
│ │ ├── LRUCache.js
│ │ ├── LRUCacheOnMap.js
│ │ ├── README.ko-KR.md
│ │ ├── README.md
│ │ └── __test__/
│ │ ├── LRUCache.test.js
│ │ └── LRUCacheOnMap.test.js
│ ├── priority-queue/
│ │ ├── PriorityQueue.js
│ │ ├── README.fr-FR.md
│ │ ├── README.ja-JP.md
│ │ ├── README.ko-KR.md
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── README.ru-RU.md
│ │ ├── README.uk-UA.md
│ │ ├── README.zh-CN.md
│ │ └── __test__/
│ │ └── PriorityQueue.test.js
│ ├── queue/
│ │ ├── Queue.js
│ │ ├── README.fr-FR.md
│ │ ├── README.ja-JP.md
│ │ ├── README.ko-KR.md
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── README.ru-RU.md
│ │ ├── README.uk-UA.md
│ │ ├── README.vi-VN.md
│ │ ├── README.zh-CN.md
│ │ └── __test__/
│ │ └── Queue.test.js
│ ├── stack/
│ │ ├── README.fr-FR.md
│ │ ├── README.ja-JP.md
│ │ ├── README.ko-KR.md
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── README.ru-RU.md
│ │ ├── README.uk-UA.md
│ │ ├── README.vi-VN.md
│ │ ├── README.zh-CN.md
│ │ ├── Stack.js
│ │ └── __test__/
│ │ └── Stack.test.js
│ ├── tree/
│ │ ├── BinaryTreeNode.js
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── README.zh-CN.md
│ │ ├── __test__/
│ │ │ └── BinaryTreeNode.test.js
│ │ ├── avl-tree/
│ │ │ ├── AvlTree.js
│ │ │ ├── README.md
│ │ │ ├── README.pt-BR.md
│ │ │ └── __test__/
│ │ │ └── AvlTRee.test.js
│ │ ├── binary-search-tree/
│ │ │ ├── BinarySearchTree.js
│ │ │ ├── BinarySearchTreeNode.js
│ │ │ ├── README.md
│ │ │ ├── README.pt-BR.md
│ │ │ └── __test__/
│ │ │ ├── BinarySearchTree.test.js
│ │ │ └── BinarySearchTreeNode.test.js
│ │ ├── fenwick-tree/
│ │ │ ├── FenwickTree.js
│ │ │ ├── README.md
│ │ │ ├── README.pt-BR.md
│ │ │ └── __test__/
│ │ │ └── FenwickTree.test.js
│ │ ├── red-black-tree/
│ │ │ ├── README.md
│ │ │ ├── README.pt-BR.md
│ │ │ ├── RedBlackTree.js
│ │ │ └── __test__/
│ │ │ └── RedBlackTree.test.js
│ │ └── segment-tree/
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── SegmentTree.js
│ │ └── __test__/
│ │ └── SegmentTree.test.js
│ └── trie/
│ ├── README.ko-KO.md
│ ├── README.md
│ ├── README.pt-BR.md
│ ├── README.ru-RU.md
│ ├── README.uk-UA.md
│ ├── README.zh-CN.md
│ ├── Trie.js
│ ├── TrieNode.js
│ └── __test__/
│ ├── Trie.test.js
│ └── TrieNode.test.js
├── playground/
│ ├── README.md
│ ├── __test__/
│ │ └── playground.test.js
│ └── playground.js
└── utils/
└── comparator/
├── Comparator.js
└── __test__/
└── Comparator.test.js
================================================
FILE CONTENTS
================================================
================================================
FILE: .babelrc
================================================
{
"presets": ["@babel/preset-env"]
}
================================================
FILE: .editorconfig
================================================
# @see: https://editorconfig.org/
root = true
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
quote_type = single
================================================
FILE: .eslintrc
================================================
{
"root": true,
"extends": "airbnb",
"plugins": ["jest"],
"env": {
"jest/globals": true
},
"rules": {
"no-bitwise": "off",
"no-lonely-if": "off",
"class-methods-use-this": "off",
"arrow-body-style": "off",
"no-loop-func": "off"
},
"ignorePatterns": ["*.md", "*.png", "*.jpeg", "*.jpg"],
"settings": {
"react": {
"version": "18.2.0"
}
}
}
================================================
FILE: .github/workflows/CI.yml
================================================
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 22.x ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm i
- name: Run linting
run: npm run lint
- name: Run tests
run: npm run coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
================================================
FILE: .gitignore
================================================
node_modules
.idea
coverage
.vscode
.DS_Store
================================================
FILE: .husky/pre-commit
================================================
npm run lint
================================================
FILE: .npmrc
================================================
engine-strict=true
================================================
FILE: .nvmrc
================================================
v22
================================================
FILE: BACKERS.md
================================================
# Project Backers
> You may support this project via ❤️️ [GitHub](https://github.com/sponsors/trekhleb) or ❤️️ [Patreon](https://www.patreon.com/trekhleb).
## `O(2ⁿ)` Backers
`null`
## `O(n²)` Backers
`null`
## `O(n×log(n))` Backers
`null`
<!--
<table>
<tr>
<td align="center">
<a href="[PROFILE_URL]">
<img
src="[PROFILE_IMG_SRC]"
width="50"
height="50"
/>
</a>
<br />
<a href="[PROFILE_URL]">[PROFILE_NAME]</a>
</td>
</tr>
</table>
-->
<!--
<ul>
<li>
<a href="[PROFILE_URL]">
<img
src="[PROFILE_IMG_SRC]"
width="30"
height="30"
/></a>
 
<a href="[PROFILE_URL]">[PROFILE_NAME]</a>
</li>
</ul>
-->
================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
================================================
FILE: CONTRIBUTING.md
================================================
## Contributing
**General Rules**
- As much as possible, try to follow the existing format of markdown and code.
- Don't forget to run `npm run lint` and `npm test` before submitting pull requests.
- Make sure that **100%** of your code is covered by tests.
**Contributing New Translation**
- Create new `README.xx-XX.md` file with translation alongside with
main `README.md` file where `xx-XX` is [locale and country/region codes](http://www.lingoes.net/en/translator/langcode.htm).
For example `en-US`, `zh-CN`, `zh-TW`, `ko-KR` etc.
- You may also translate all other sub-folders by creating
related `README.xx-XX.md` files in each of them.
**Contributing New Algorithms**
- Make your pull requests to be **specific** and **focused**. Instead of
contributing "several sorting algorithms" all at once contribute them all
one by one separately (i.e. one pull request for "Quick Sort", another one
for "Heap Sort" and so on).
- Provide **README.md** for each of the algorithms **with explanations** of
the algorithm and **with links** to further readings.
- Describe what you do in code using **comments**.
================================================
FILE: LICENSE
================================================
The MIT License (MIT)
Copyright (c) 2018 Oleksii Trekhleb
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.ar-AR.md
================================================
# جافا سكريبت خوارزميات وهياكل البيانات
[](https://travis-ci.org/trekhleb/javascript-algorithms)
[](https://codecov.io/gh/trekhleb/javascript-algorithms)
تحتوي هذه المقالة على أمثلة عديدة تستند إلى الخوارزميات الشائعة وهياكل البيانات في الجافا سكريبت.
كل خوارزمية وهياكل البيانات لها برنامج 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),
[_Türk_](README.tr-TR.md),
[_Italiana_](README.it-IT.md),
[_Tiếng Việt_](README.vi-VN.md),
[_Deutsch_](README.de-DE.md),
[_Uzbek_](README.uz-UZ.md)
[_עברית_](README.he-IL.md)
## هياكل البيانات
هياكل البيانات هي طريقة خاصة لتنظيم البيانات وتخزينها في جهاز الكمبيوتر بحيث
يمكن الوصول إليها وتعديلها بكفاءة. بتعبير أدق ، هيكل البيانات هو مجموعة من البيانات
القيم والعلاقات فيما بينها والوظائف أو العمليات التي يمكن تطبيقها عليها
البيانات.
`B` - مبتدئ, `A` - المتقدمة
* `B` [قائمة مرتبطة](src/data-structures/linked-list)
* `B` [قائمة مرتبطة بشكل مضاعف](src/data-structures/doubly-linked-list)
* `B` [طابور, Queue](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` [شجرة الأحمر والأسود](src/data-structures/tree/red-black-tree)
* `A` [شجرة القطعة](src/data-structures/tree/segment-tree) - مع أمثلة على استفسارات النطاق الأدنى / الأقصى / المجموع
* `A` [شجرة فينويك](src/data-structures/tree/fenwick-tree) (شجرة ثنائية مفهرسة)
* `A` [Graph](src/data-structures/graph) (كلاهما موجه وغير موجه)
* `A` [مجموعة منفصلة](src/data-structures/disjoint-set)
* `A` [مرشح بلوم](src/data-structures/bloom-filter)
## الخوارزميات
الخوارزمية هي تحديد لا لبس فيه لكيفية حل فئة من المشاكل. أنه
مجموعة من القواعد التي تحدد بدقة تسلسل العمليات.
`B` - مبتدئ ، `A` - متقدم
### الخوارزميات حسب الموضوع
* **رياضيات**
* `B` [معالجة البت](src/algorithms/math/bits)
* `B` [عاملي](src/algorithms/math/factorial)
* `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` [هي قوة اثنين](src/algorithms/math/is-power-of-two) - تحقق مما إذا كان الرقم هو قوة اثنين (الخوارزميات الساذجة والبتية)
* `B` [مثلث باسكال](src/algorithms/math/pascal-triangle)
* `B` [عدد مركب](src/algorithms/math/complex-number) - الأعداد المركبة والعمليات الأساسية معهم
* `B` [راديان ودرجة](src/algorithms/math/radian) - راديان لدرجة التحويل والعكس
* `B` [تشغيل سريع](src/algorithms/math/fast-powering)
* `B` [طريقة هورنر](src/algorithms/math/horner-method) - تقييم متعدد الحدود
* `A` [قسم صحيح](src/algorithms/math/integer-partition)
* `A` [الجذر التربيعي](src/algorithms/math/square-root) - طريقة نيوتن
* `A` [خوارزمية ليو هوي π](src/algorithms/math/liu-hui) - π حسابات تقريبية على أساس N-gons
* `A` [تحويل فورييه المنفصل](src/algorithms/math/fourier-transform) - حلل وظيفة الوقت (إشارة) في الترددات التي يتكون منها
* **مجموعات**
* `B` [المنتج الديكارتي](src/algorithms/sets/cartesian-product) - منتج من مجموعات متعددة
* `B` [فيشر ييتس شافل](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` [الحد الأقصى من Subarray](src/algorithms/sets/maximum-subarray) -إصدارات "القوة الغاشمة" و "البرمجة الديناميكية" (كادان)
* `A` [مجموع الجمع](src/algorithms/sets/combination-sum) - ابحث عن جميع التركيبات التي تشكل مبلغًا محددًا
* **سلاسل**
* `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)
* **عمليات البحث**
* `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` [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) - عمليات التنفيذ في المكان وغير في المكان
* `B` [Shellsort](src/algorithms/sorting/shell-sort)
* `B` [Counting Sort](src/algorithms/sorting/counting-sort)
* `B` [Radix Sort](src/algorithms/sorting/radix-sort)
* **القوائم المرتبطة**
* `B` [Straight Traversal](src/algorithms/linked-list/traversal)
* `B` [Reverse Traversal](src/algorithms/linked-list/reverse-traversal)
* **الأشجار**
* `B` [Depth-First Search](src/algorithms/tree/depth-first-search) (DFS)
* `B` [Breadth-First Search](src/algorithms/tree/breadth-first-search) (BFS)
* **الرسوم البيانية**
* `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) - إيجاد الحد الأدنى من شجرة الامتداد (MST) للرسم البياني الموزون غير الموجه
* `A` [Dijkstra Algorithm](src/algorithms/graph/dijkstra) -إيجاد أقصر المسارات لجميع رؤوس الرسم البياني من رأس واحد
* `A` [Bellman-Ford Algorithm](src/algorithms/graph/bellman-ford) - إيجاد أقصر المسارات لجميع رؤوس الرسم البياني من رأس واحد
* `A` [Floyd-Warshall Algorithm](src/algorithms/graph/floyd-warshall) - إيجاد أقصر المسارات بين جميع أزواج الرؤوس
* `A` [Detect Cycle](src/algorithms/graph/detect-cycle) - لكل من الرسوم البيانية الموجهة وغير الموجهة (الإصدارات القائمة على DFS و Disjoint Set)
* `A` [Prim’s Algorithm](src/algorithms/graph/prim) - إيجاد الحد الأدنى من شجرة الامتداد (MST) للرسم البياني الموزون غير الموجه
* `A` [Topological Sorting](src/algorithms/graph/topological-sorting) - طريقة البحث العمق الأول (DFS)
* `A` [Articulation Points](src/algorithms/graph/articulation-points) - خوارزمية تارجان (تعتمد على DFS)
* `A` [Bridges](src/algorithms/graph/bridges) - خوارزمية تعتمد على DFS
* `A` [Eulerian Path and Eulerian Circuit](src/algorithms/graph/eulerian-path) - خوارزمية فلوري - قم بزيارة كل حافة مرة واحدة بالضبط
* `A` [Hamiltonian Cycle](src/algorithms/graph/hamiltonian-cycle) - قم بزيارة كل قمة مرة واحدة بالضبط
* `A` [Strongly Connected Components](src/algorithms/graph/strongly-connected-components) - خوارزمية Kosaraju
* `A` [Travelling Salesman Problem](src/algorithms/graph/travelling-salesman) - أقصر طريق ممكن يزور كل مدينة ويعود إلى المدينة الأصلية
* **التشفير
* `B` [Polynomial Hash](src/algorithms/cryptography/polynomial-hash) - المتداول دالة التجزئة على أساس متعدد الحدود
* `B` [Caesar Cipher](src/algorithms/cryptography/caesar-cipher) - استبدال بسيط للشفرات
* **التعلم الالي**
* `B` [NanoNeuron](https://github.com/trekhleb/nano-neuron) - 7 وظائف JS بسيطة توضح كيف يمكن للآلات أن تتعلم بالفعل (الانتشار إلى الأمام / الخلف)
* **غير مصنف**
* `B` [Tower of Hanoi](src/algorithms/uncategorized/hanoi-tower)
* `B` [Square Matrix Rotation](src/algorithms/uncategorized/square-matrix-rotation) - خوارزمية في المكان
* `B` [Jump Game](src/algorithms/uncategorized/jump-game) - التراجع ، البرمجة الديناميكية (من أعلى إلى أسفل + من أسفل إلى أعلى) والأمثلة الجشعة
* `B` [Unique Paths](src/algorithms/uncategorized/unique-paths) - التراجع والبرمجة الديناميكية والأمثلة القائمة على مثلث باسكال
* `B` [Rain Terraces](src/algorithms/uncategorized/rain-terraces) - محاصرة مشكلة مياه الأمطار (البرمجة الديناميكية وإصدارات القوة الغاشمة)
* `B` [Recursive Staircase](src/algorithms/uncategorized/recursive-staircase) - احسب عدد الطرق للوصول إلى القمة (4 حلول)
* `A` [N-Queens Problem](src/algorithms/uncategorized/n-queens)
* `A` [Knight's Tour](src/algorithms/uncategorized/knight-tour)
### الخوارزميات حسب النموذج
النموذج الحسابي هو طريقة أو نهج عام يكمن وراء تصميم الفصل
من الخوارزميات. إنه تجريد أعلى من مفهوم الخوارزمية ، تمامًا مثل
الخوارزمية هي تجريد أعلى من برنامج الكمبيوتر.
* **القوة الغاشمة** - انظر في جميع الاحتمالات وحدد الحل الأفضل
* `B` [Linear Search](src/algorithms/search/linear-search)
* `B` [Rain Terraces](src/algorithms/uncategorized/rain-terraces) - محاصرة مشكلة مياه الأمطار
* `B` [Recursive Staircase](src/algorithms/uncategorized/recursive-staircase) - احسب عدد الطرق للوصول إلى القمة
* `A` [Maximum Subarray](src/algorithms/sets/maximum-subarray)
* `A` [Travelling Salesman Problem](src/algorithms/graph/travelling-salesman) - أقصر طريق ممكن يزور كل مدينة ويعود إلى المدينة الأصلية
* `A` [Discrete Fourier Transform](src/algorithms/math/fourier-transform) - حلل وظيفة الوقت (إشارة) في الترددات التي يتكون منها
* **جشع** - اختر الخيار الأفضل في الوقت الحالي ، دون أي اعتبار للمستقبل
* `B` [Jump Game](src/algorithms/uncategorized/jump-game)
* `A` [Unbound Knapsack Problem](src/algorithms/sets/knapsack-problem)
* `A` [Dijkstra Algorithm](src/algorithms/graph/dijkstra) - إيجاد أقصر مسار لجميع رؤوس الرسم البياني
* `A` [Prim’s Algorithm](src/algorithms/graph/prim) - إيجاد الحد الأدنى من شجرة الامتداد (MST) للرسم البياني الموزون غير الموجه
* `A` [Kruskal’s Algorithm](src/algorithms/graph/kruskal) - إيجاد الحد الأدنى من شجرة الامتداد (MST) للرسم البياني الموزون غير الموجه
* **فرق تسد** - قسّم المشكلة إلى أجزاء أصغر ثم حل تلك الأجزاء
* `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) - حساب القاسم المشترك الأكبر (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) (مع التكرار وبدونه)
* `A` [Combinations](src/algorithms/sets/combinations) (مع التكرار وبدونه)
* **البرمجة الديناميكية** - بناء حل باستخدام الحلول الفرعية التي تم العثور عليها مسبقًا
* `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) - محاصرة مشكلة مياه الأمطار
* `B` [Recursive Staircase](src/algorithms/uncategorized/recursive-staircase) - احسب عدد الطرق للوصول إلى القمة
* `A` [Levenshtein Distance](src/algorithms/string/levenshtein-distance) - الحد الأدنى لمسافة التحرير بين تسلسلين
* `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) - إيجاد أقصر مسار لجميع رؤوس الرسم البياني
* `A` [Floyd-Warshall Algorithm](src/algorithms/graph/floyd-warshall) - إيجاد أقصر المسارات بين جميع أزواج الرؤوس
* `A` [Regular Expression Matching](src/algorithms/string/regular-expression-matching)
* **التراجع** - على غرار القوة الغاشمة ، حاول إنشاء جميع الحلول الممكنة ، ولكن في كل مرة تقوم فيها بإنشاء الحل التالي الذي تختبره
إذا استوفت جميع الشروط ، وعندها فقط استمر في إنشاء الحلول اللاحقة. خلاف ذلك ، تراجع ، واذهب إلى
طريق مختلف لإيجاد حل. عادةً ما يتم استخدام اجتياز DFS لمساحة الدولة.
* `B` [Jump Game](src/algorithms/uncategorized/jump-game)
* `B` [Unique Paths](src/algorithms/uncategorized/unique-paths)
* `B` [Power Set](src/algorithms/sets/power-set) - جميع المجموعات الفرعية للمجموعة
* `A` [Hamiltonian Cycle](src/algorithms/graph/hamiltonian-cycle) - قم بزيارة كل قمة مرة واحدة بالضبط
* `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) - ابحث عن جميع التركيبات التي تشكل مبلغًا محددًا
* ** Branch & Bound ** - تذكر الحل الأقل تكلفة الموجود في كل مرحلة من مراحل التراجع
البحث ، واستخدام تكلفة الحل الأقل تكلفة الموجود حتى الآن بحد أدنى لتكلفة
الحل الأقل تكلفة للمشكلة ، من أجل تجاهل الحلول الجزئية بتكاليف أكبر من
تم العثور على حل بأقل تكلفة حتى الآن. اجتياز BFS عادةً بالاشتراك مع اجتياز DFS لمساحة الحالة
يتم استخدام الشجرة.
## كيفية استخدام هذا المستودع
**تثبيت كل التبعيات**
```
npm install
```
**قم بتشغيل ESLint**
قد ترغب في تشغيله للتحقق من جودة الكود.
```
npm run lint
```
**قم بإجراء جميع الاختبارات**
```
npm test
```
**قم بإجراء الاختبارات بالاسم**
```
npm test -- 'LinkedList'
```
**ملعب**
يمكنك اللعب بهياكل البيانات والخوارزميات في ملف `. /src/playground/playground.js` والكتابة
اختبارات لها في `./src/playground/__test__/playground.test.js`.
ثم قم ببساطة بتشغيل الأمر التالي لاختبار ما إذا كان كود الملعب الخاص بك يعمل كما هو متوقع:
```
npm test -- 'playground'
```
## معلومات مفيدة
### المراجع
[▶ هياكل البيانات والخوارزميات على موقع يوتيوب](https://www.youtube.com/playlist?list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8)
### Big O Notation
* يتم استخدام **Big O notation** لتصنيف الخوارزميات وفقًا لكيفية نمو متطلبات وقت التشغيل أو المساحة مع نمو حجم الإدخال.
قد تجد في الرسم البياني أدناه الأوامر الأكثر شيوعًا لنمو الخوارزميات المحددة في تBig O notation.

مصدر: [Big O Cheat Sheet](http://bigocheatsheet.com/).
فيما يلي قائمة ببعض رموز Big O notation الأكثر استخدامًا ومقارنات أدائها مقابل أحجام مختلفة من بيانات الإدخال.
| 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 | n | |
| **Hash Table** | - | n | n | n |في حالة وجود تكاليف دالة تجزئة مثالية ستكون O (1)|
| **Binary Search Tree** | n | n | n | n | في حالة توازن تكاليف الشجرة ستكون 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 | - |الإيجابيات الكاذبة ممكنة أثناء البحث|
### تعقيد خوارزميات فرز الصفيف
| Name | Best | Average | Worst | Memory | Stable | Comments |
| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- |
| **Bubble sort** | n | n<sup>2</sup> | n<sup>2</sup> | 1 | نعم | |
| **Insertion sort** | n | n<sup>2</sup> | n<sup>2</sup> | 1 | نعم | |
| **Selection sort** | n<sup>2</sup> | n<sup>2</sup> | n<sup>2</sup> | 1 | لا | |
| **Heap sort** | n log(n) | n log(n) | n log(n) | 1 | لا | |
| **Merge sort** | n log(n) | n log(n) | n log(n) | n | نعم | |
| **Quick sort** | n log(n) | n log(n) | n<sup>2</sup> | log(n) | No | عادةً ما يتم إجراء الفرز السريع في مكانه مع مساحة مكدس O (log (n))|
| **Shell sort** | n log(n) | depends on gap sequence | n (log(n))<sup>2</sup> | 1 | لا | |
| **Counting sort** | n + r | n + r | n + r | n + r | Yes |r - أكبر رقم في المجموعة|
| **Radix sort** | n * k | n * k | n * k | n + k | Yes | ك - طول أطول مفتاح |
## مؤيدو المشروع
> يمكنك دعم هذا المشروع عبر ❤️️ [GitHub](https://github.com/sponsors/trekhleb) أو ❤️️ [Patreon](https://www.patreon.com/trekhleb).
[الناس الذين يدعمون هذا المشروع](https://github.com/trekhleb/javascript-algorithms/blob/master/BACKERS.md) `∑ = 0`
> ℹ️ A few more [projects](https://trekhleb.dev/projects/) and [articles](https://trekhleb.dev/blog/) about JavaScript and algorithms on [trekhleb.dev](https://trekhleb.dev)
================================================
FILE: README.de-DE.md
================================================
# JavaScript-Algorithmen und Datenstrukturen
[](https://github.com/trekhleb/javascript-algorithms/actions?query=workflow%3ACI+branch%3Amaster)
[](https://codecov.io/gh/trekhleb/javascript-algorithms)
Dieses Repository enthält JavaScript Beispiele für viele
gängige Algorithmen und Datenstrukturen.
Jeder Algorithmus und jede Datenstruktur hat eine eigene README
mit zugehörigen Erklärungen und weiterführenden Links (einschließlich zu YouTube-Videos).
_Lies dies in anderen Sprachen:_
[_English_](https://github.com/trekhleb/javascript-algorithms/)
[_简体中文_](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),
[_Türk_](README.tr-TR.md),
[_Italiana_](README.it-IT.md),
[_Bahasa Indonesia_](README.id-ID.md),
[_Українська_](README.uk-UA.md),
[_Arabic_](README.ar-AR.md),
[_Uzbek_](README.uz-UZ.md)
[_עברית_](README.he-IL.md)
## Datenstrukturen
Eine Datenstruktur ist eine bestimmte Art und Weise, Daten in einem Computer so zu organisieren und zu speichern, dass sie
effizient erreicht und verändert werden können. Genauer gesagt, ist eine Datenstruktur eine Sammlung von Werten,
den Beziehungen zwischen ihnen und den Funktionen oder Operationen, die auf die Daten angewendet werden können.
`B` - Anfänger:innen, `A` - Fortgeschrittene
* `B` [Verkettete Liste (Linked List)](src/data-structures/linked-list)
* `B` [Doppelt verkettete Liste (Doubly Linked List)](src/data-structures/doubly-linked-list)
* `B` [Warteschlange (Queue)](src/data-structures/queue)
* `B` [Stapelspeicher (Stack)](src/data-structures/stack)
* `B` [Hashtabelle (Hash Table)](src/data-structures/hash-table)
* `B` [Heap-Algorithmus (Heap)](src/data-structures/heap) - max und min Heap-Versionen
* `B` [Vorrangwarteschlange (Priority Queue)](src/data-structures/priority-queue)
* `A` [Trie (Trie)](src/data-structures/trie)
* `A` [Baum (Tree)](src/data-structures/tree)
* `A` [Binärer Suchbaum (Binary Search Tree)](src/data-structures/tree/binary-search-tree)
* `A` [AVL-Baum (AVL Tree)](src/data-structures/tree/avl-tree)
* `A` [Rot-Schwarz-Baum (Red-Black Tree)](src/data-structures/tree/red-black-tree)
* `A` [Segment-Baum (Segment Tree)](src/data-structures/tree/segment-tree) - mit Min/Max/Summenbereich-Abfrage Beispiel
* `A` [Fenwick Baum (Fenwick Tree)](src/data-structures/tree/fenwick-tree) (Binär indizierter Baum / Binary Indexed Tree)
* `A` [Graph (Graph)](src/data-structures/graph) (sowohl gerichtet als auch ungerichtet)
* `A` [Union-Find-Struktur (Disjoint Set)](src/data-structures/disjoint-set)
* `A` [Bloomfilter (Bloom Filter)](src/data-structures/bloom-filter)
## Algorithmen
Ein Algorithmus ist eine eindeutige Spezifikation, wie eine Klasse von Problemen zu lösen ist. Er besteht
aus einem Satz von Regeln, die eine Abfolge von Operationen genau definieren.
`B` - Anfänger:innen, `A` - Fortgeschrittene
### Algorithmen nach Thema
* **Mathe**
* `B` [Bitmanipulation (Bit Manipulation)](src/algorithms/math/bits) - Bits setzen/lesen/aktualisieren/löschen, Multiplikation/Division durch zwei negieren usw..
* `B` [Faktoriell (Factorial)](src/algorithms/math/factorial)
* `B` [Fibonacci-Zahl (Fibonacci Number)](src/algorithms/math/fibonacci) - Klassische und geschlossene Version
* `B` [Primfaktoren (Prime Factors)](src/algorithms/math/prime-factors) - Auffinden von Primfaktoren und deren Zählung mit Hilfe des Satz von Hardy-Ramanujan (Hardy-Ramanujan's theorem)
* `B` [Primzahl-Test (Primality Test)](src/algorithms/math/primality-test) (Probedivision / trial division method)
* `B` [Euklidischer Algorithmus (Euclidean Algorithm)](src/algorithms/math/euclidean-algorithm) - Berechnen des größten gemeinsamen Teilers (ggT)
* `B` [Kleinstes gemeinsames Vielfaches (Least Common Multiple)](src/algorithms/math/least-common-multiple) (kgV)
* `B` [Sieb des Eratosthenes (Sieve of Eratosthenes)](src/algorithms/math/sieve-of-eratosthenes) - Finden aller Primzahlen bis zu einer bestimmten Grenze
* `B` [Power of two (Is Power of Two)](src/algorithms/math/is-power-of-two) - Prüft, ob die Zahl eine Zweierpotenz ist (naive und bitweise Algorithmen)
* `B` [Pascalsches Dreieck (Pascal's Triangle)](src/algorithms/math/pascal-triangle)
* `B` [Komplexe Zahlen (Complex Number)](src/algorithms/math/complex-number) - Komplexe Zahlen und Grundoperationen mit ihnen
* `B` [Bogenmaß & Grad (Radian & Degree)](src/algorithms/math/radian) - Umrechnung von Bogenmaß in Grad und zurück
* `B` [Fast Powering Algorithmus (Fast Powering)](src/algorithms/math/fast-powering)
* `B` [Horner-Schema (Horner's method)](src/algorithms/math/horner-method) - Polynomauswertung
* `B` [Matrizen (Matrices)](src/algorithms/math/matrix) - Matrizen und grundlegende Matrixoperationen (Multiplikation, Transposition usw.)
* `B` [Euklidischer Abstand (Euclidean Distance)](src/algorithms/math/euclidean-distance) - Abstand zwischen zwei Punkten/Vektoren/Matrizen
* `A` [Ganzzahlige Partitionierung (Integer Partition)](src/algorithms/math/integer-partition)
* `A` [Quadratwurzel (Square Root)](src/algorithms/math/square-root) - Newtonverfahren (Newton's method)
* `A` [Liu Hui π Algorithmus (Liu Hui π Algorithm)](src/algorithms/math/liu-hui) - Näherungsweise π-Berechnungen auf Basis von N-gons
* `A` [Diskrete Fourier-Transformation (Discrete Fourier Transform)](src/algorithms/math/fourier-transform) - Eine Funktion der Zeit (ein Signal) in die Frequenzen zerlegen, aus denen sie sich zusammensetzt
* **Sets**
* `B` [Kartesisches Produkt (Cartesian Product)](src/algorithms/sets/cartesian-product) - Produkt aus mehreren Mengen
* `B` [Fisher-Yates-Verfahren (Fisher–Yates Shuffle)](src/algorithms/sets/fisher-yates) - Zufällige Permutation einer endlichen Folge
* `A` [Potenzmenge (Power Set)](src/algorithms/sets/power-set) - Alle Teilmengen einer Menge (Bitweise und Rücksetzverfahren Lösungen(backtracking solutions))
* `A` [Permutation (Permutations)](src/algorithms/sets/permutations) (mit und ohne Wiederholungen)
* `A` [Kombination (Combinations)](src/algorithms/sets/combinations) (mit und ohne Wiederholungen)
* `A` [Problem der längsten gemeinsamen Teilsequenz (Longest Common Subsequence)](src/algorithms/sets/longest-common-subsequence) (LCS)
* `A` [Längste gemeinsame Teilsequenz (Longest Increasing Subsequence)](src/algorithms/sets/longest-increasing-subsequence)
* `A` [Der kürzeste gemeinsame String (Shortest Common Supersequence)](src/algorithms/sets/shortest-common-supersequence) (SCS)
* `A` [Rucksackproblem (Knapsack Problem)](src/algorithms/sets/knapsack-problem) - "0/1" und "Ungebunden"
* `A` [Das Maximum-Subarray Problem (Maximum Subarray)](src/algorithms/sets/maximum-subarray) - "Brute-Force-Methode" und "Dynamische Programmierung" (Kadane' Algorithmus)
* `A` [Kombinationssumme (Combination Sum)](src/algorithms/sets/combination-sum) - Alle Kombinationen finden, die eine bestimmte Summe bilden
* **Zeichenketten (Strings)**
* `B` [Hamming-Abstand (Hamming Distance)](src/algorithms/string/hamming-distance) - Anzahl der Positionen, an denen die Symbole unterschiedlich sind
* `A` [Levenshtein-Distanz (Levenshtein Distance)](src/algorithms/string/levenshtein-distance) - Minimaler Editierabstand zwischen zwei Sequenzen
* `A` [Knuth-Morris-Pratt-Algorithmus (Knuth–Morris–Pratt Algorithm)](src/algorithms/string/knuth-morris-pratt) (KMP Algorithmus) - Teilstringsuche (Mustervergleich / Pattern Matching)
* `A` [Z-Algorithmus (Z Algorithm)](src/algorithms/string/z-algorithm) - Teilstringsuche (Mustervergleich / Pattern Matching)
* `A` [Rabin-Karp-Algorithmus (Rabin Karp Algorithm)](src/algorithms/string/rabin-karp) - Teilstringsuche
* `A` [Längstes häufiges Teilzeichenfolgenproblem (Longest Common Substring)](src/algorithms/string/longest-common-substring)
* `A` [Regulärer Ausdruck (Regular Expression Matching)](src/algorithms/string/regular-expression-matching)
* **Suchen**
* `B` [Lineare Suche (Linear Search)](src/algorithms/search/linear-search)
* `B` [Sprungsuche (Jump Search)](src/algorithms/search/jump-search) (oder Blocksuche) - Suche im sortierten Array
* `B` [Binäre Suche (Binary Search)](src/algorithms/search/binary-search) - Suche in einem sortierten Array
* `B` [Interpolationssuche (Interpolation Search)](src/algorithms/search/interpolation-search) - Suche in gleichmäßig verteilt sortiertem Array
* **Sortieren**
* `B` [Bubblesort (Bubble Sort)](src/algorithms/sorting/bubble-sort)
* `B` [Selectionsort (Selection Sort)](src/algorithms/sorting/selection-sort)
* `B` [Einfügesortierenmethode (Insertion Sort)](src/algorithms/sorting/insertion-sort)
* `B` [Haldensortierung (Heap Sort)](src/algorithms/sorting/heap-sort)
* `B` [Mergesort (Merge Sort)](src/algorithms/sorting/merge-sort)
* `B` [Quicksort (Quicksort)](src/algorithms/sorting/quick-sort) - in-place und non-in-place Implementierungen
* `B` [Shellsort (Shellsort)](src/algorithms/sorting/shell-sort)
* `B` [Countingsort (Counting Sort)](src/algorithms/sorting/counting-sort)
* `B` [Fachverteilen (Radix Sort)](src/algorithms/sorting/radix-sort)
* **Verkettete Liste (Linked List)**
* `B` [Gerade Traversierung (Straight Traversal)](src/algorithms/linked-list/traversal)
* `B` [Umgekehrte Traversierung (Reverse Traversal)](src/algorithms/linked-list/reverse-traversal)
* **Bäume**
* `B` [Tiefensuche (Depth-First Search)](src/algorithms/tree/depth-first-search) (DFS)
* `B` [Breitensuche (Breadth-First Search)](src/algorithms/tree/breadth-first-search) (BFS)
* **Graphen**
* `B` [Tiefensuche (Depth-First Search)](src/algorithms/graph/depth-first-search) (DFS)
* `B` [Breitensuche (Breadth-First Search)](src/algorithms/graph/breadth-first-search) (BFS)
* `B` [Algorithmus von Kruskal (Kruskal’s Algorithm)](src/algorithms/graph/kruskal) - Finden des Spannbaum (Minimum Spanning Tree / MST) für einen gewichteten ungerichteten Graphen
* `A` [Dijkstra-Algorithmus (Dijkstra Algorithm)](src/algorithms/graph/dijkstra) - Finden der kürzesten Wege zu allen Knoten des Graphen von einem einzelnen Knotenpunkt aus
* `A` [Bellman-Ford-Algorithmus (Bellman-Ford Algorithm)](src/algorithms/graph/bellman-ford) - Finden der kürzesten Wege zu allen Knoten des Graphen von einem einzelnen Knotenpunkt aus
* `A` [Algorithmus von Floyd und Warshall (Floyd-Warshall Algorithm)](src/algorithms/graph/floyd-warshall) - Die kürzesten Wege zwischen allen Knotenpaaren finden
* `A` [Zykluserkennung (Detect Cycle)](src/algorithms/graph/detect-cycle) - Sowohl für gerichtete als auch für ungerichtete Graphen (DFS- und Disjoint-Set-basierte Versionen)
* `A` [Algorithmus von Prim (Prim’s Algorithm)](src/algorithms/graph/prim) - Finden des Spannbaums (Minimum Spanning Tree / MST) für einen gewichteten ungerichteten Graphen
* `A` [Topologische Sortierung (Topological Sorting)](src/algorithms/graph/topological-sorting) - DFS-Verfahren
* `A` [Artikulationspunkte (Articulation Points)](src/algorithms/graph/articulation-points) - Algorithmus von Tarjan (Tarjan's algorithm) (DFS basiert)
* `A` [Brücke (Bridges)](src/algorithms/graph/bridges) - DFS-basierter Algorithmus
* `A` [Eulerkreisproblem (Eulerian Path and Eulerian Circuit)](src/algorithms/graph/eulerian-path) - Algorithmus von Fleury (Fleury's algorithm) - Jede Kante genau einmal durchlaufen.
* `A` [Hamiltonkreisproblem (Hamiltonian Cycle)](src/algorithms/graph/hamiltonian-cycle) - Jeden Eckpunkt genau einmal durchlaufen.
* `A` [Starke Zusammenhangskomponente (Strongly Connected Components)](src/algorithms/graph/strongly-connected-components) - Kosarajus Algorithmus
* `A` [Problem des Handlungsreisenden (Travelling Salesman Problem)](src/algorithms/graph/travelling-salesman) - Kürzestmögliche Route, die jede Stadt besucht und zur Ausgangsstadt zurückkehrt
* **Kryptographie**
* `B` [Polynomiale Streuwertfunktion(Polynomial Hash)](src/algorithms/cryptography/polynomial-hash) - Rollierende Streuwert-Funktion basierend auf Polynom
* `B` [Schienenzaun Chiffre (Rail Fence Cipher)](src/algorithms/cryptography/rail-fence-cipher) - Ein Transpositionsalgorithmus zur Verschlüsselung von Nachrichten
* `B` [Caesar-Verschlüsselung (Caesar Cipher)](src/algorithms/cryptography/caesar-cipher) - Einfache Substitutions-Chiffre
* `B` [Hill-Chiffre (Hill Cipher)](src/algorithms/cryptography/hill-cipher) - Substitutionschiffre basierend auf linearer Algebra
* **Maschinelles Lernen**
* `B` [Künstliches Neuron (NanoNeuron)](https://github.com/trekhleb/nano-neuron) - 7 einfache JS-Funktionen, die veranschaulichen, wie Maschinen tatsächlich lernen können (Vorwärts-/Rückwärtspropagation)
* `B` [Nächste-Nachbarn-Klassifikation (k-NN)](src/algorithms/ml/knn) - k-nächste-Nachbarn-Algorithmus
* `B` [k-Means (k-Means)](src/algorithms/ml/k-means) - k-Means-Algorithmus
* **Image Processing**
* `B` [Inhaltsabhängige Bildverzerrung (Seam Carving)](src/algorithms/image-processing/seam-carving) - Algorithmus zur inhaltsabhängigen Bildgrößenänderung
* **Unkategorisiert**
* `B` [Türme von Hanoi (Tower of Hanoi)](src/algorithms/uncategorized/hanoi-tower)
* `B` [Rotationsmatrix (Square Matrix Rotation)](src/algorithms/uncategorized/square-matrix-rotation) - In-Place-Algorithmus
* `B` [Jump Game (Jump Game)](src/algorithms/uncategorized/jump-game) - Backtracking, dynamische Programmierung (Top-down + Bottom-up) und gierige Beispiele
* `B` [Eindeutige Pfade (Unique Paths)](src/algorithms/uncategorized/unique-paths) - Backtracking, dynamische Programmierung und Pascalsches Dreieck basierte Beispiele
* `B` [Regenterrassen (Rain Terraces)](src/algorithms/uncategorized/rain-terraces) - Auffangproblem für Regenwasser (trapping rain water problem) (dynamische Programmierung und Brute-Force-Versionen)
* `B` [Rekursive Treppe (Recursive Staircase)](src/algorithms/uncategorized/recursive-staircase) - Zählen der Anzahl der Wege, die nach oben führen (4 Lösungen)
* `B` [Beste Zeit zum Kaufen/Verkaufen von Aktien (Best Time To Buy Sell Stocks)](src/algorithms/uncategorized/best-time-to-buy-sell-stocks) - Beispiele für "Teile und Herrsche" und Beispiele für den One-Pass-Algorithmus
* `A` [Damenproblem (N-Queens Problem)](src/algorithms/uncategorized/n-queens)
* `A` [Springerproblem (Knight's Tour)](src/algorithms/uncategorized/knight-tour)
### Algorithmen nach Paradigma
Ein algorithmisches Paradigma ist eine generische Methode oder ein Ansatz, der dem Entwurf einer Klasse von Algorithmen zugrunde liegt. Es ist eine Abstraktion, die höher ist als der Begriff des Algorithmus. Genauso wie ein Algorithmus eine Abstraktion ist, die höher ist als ein Computerprogramm.
* **Brachiale Gewalt (Brute Force)** - schaut sich alle Möglichkeiten an und wählt die beste Lösung aus
* `B` [Lineare Suche (Linear Search)](src/algorithms/search/linear-search)
* `B` [Regenterrassen (Rain Terraces)](src/algorithms/uncategorized/rain-terraces) - Auffangproblem für Regenwasser (trapping rain water problem) (dynamische Programmierung und Brute-Force-Versionen)
* `B` [Rekursive Treppe (Recursive Staircase)](src/algorithms/uncategorized/recursive-staircase) - Zählen der Anzahl der Wege, die nach oben führen (4 Lösungen)
* `A` [Das Maximum-Subarray Problem (Maximum Subarray)](src/algorithms/sets/maximum-subarray)
* `A` [Problem des Handlungsreisenden (Travelling Salesman Problem)](src/algorithms/graph/travelling-salesman) - Kürzestmögliche Route, die jede Stadt besucht und zur Ausgangsstadt zurückkehrt
* `A` [Diskrete Fourier-Transformation (Discrete Fourier Transform)](src/algorithms/math/fourier-transform) - Eine Funktion der Zeit (ein Signal) in die Frequenzen zerlegen, aus denen sie sich zusammensetzt
* **Gierig (Greedy)** - Wählt die beste Option zum aktuellen Zeitpunkt, ohne Rücksicht auf die Zukunft
* `B` [Jump Game (Jump Game)](src/algorithms/uncategorized/jump-game)
* `A` [Rucksackproblem (Unbound Knapsack Problem)](src/algorithms/sets/knapsack-problem)
* `A` [Dijkstra-Algorithmus (Dijkstra Algorithm)](src/algorithms/graph/dijkstra) - Finden der kürzesten Wege zu allen Knoten des Graphen von einem einzelnen Knotenpunkt aus
* `A` [Algorithmus von Prim (Prim’s Algorithm)](src/algorithms/graph/prim) - Finden des Spannbaums (Minimum Spanning Tree / MST) für einen gewichteten ungerichteten Graphen
* `B` [Algorithmus von Kruskal (Kruskal’s Algorithm)](src/algorithms/graph/kruskal) - Finden des Spannbaum (Minimum Spanning Tree / MST) für einen gewichteten ungerichteten Graphen
* **Teile und herrsche** - Das Problem in kleinere Teile aufteilen und diese Teile dann lösen
* `B` [Binäre Suche (Binary Search)](src/algorithms/search/binary-search)
* `B` [Türme von Hanoi (Tower of Hanoi)](src/algorithms/uncategorized/hanoi-tower)
* `B` [Pascalsches Dreieck (Pascal's Triangle)](src/algorithms/math/pascal-triangle)
* `B` [Euklidischer Algorithmus (Euclidean Algorithm)](src/algorithms/math/euclidean-algorithm) - calculate the Greatest Common Divisor (GCD)
* `B` [Mergesort (Merge Sort)](src/algorithms/sorting/merge-sort)
* `B` [Quicksort (Quicksort)](src/algorithms/sorting/quick-sort)
* `B` [Tiefensuche (Depth-First Search)](src/algorithms/tree/depth-first-search) (DFS)
* `B` [Breitensuche (Breadth-First Search)](src/algorithms/graph/depth-first-search) (DFS)
* `B` [Matrizen (Matrices)](src/algorithms/math/matrix) - Matrizen und grundlegende Matrixoperationen (Multiplikation, Transposition usw.)
* `B` [Jump Game (Jump Game)](src/algorithms/uncategorized/jump-game)
* `B` [Fast Powering Algorithmus (Fast Powering)](src/algorithms/math/fast-powering)
* `B` [Beste Zeit zum Kaufen/Verkaufen von Aktien (Best Time To Buy Sell Stocks)](src/algorithms/uncategorized/best-time-to-buy-sell-stocks) - Beispiele für "Teile und Herrsche" und Beispiele für den One-Pass-Algorithmus
* `A` [Permutation (Permutations)](src/algorithms/sets/permutations) (mit und ohne Wiederholungen)
* `A` [Kombination (Combinations)](src/algorithms/sets/combinations) (mit und ohne Wiederholungen)
* **Dynamische Programmierung** - Eine Lösung aus zuvor gefundenen Teillösungen aufbauen
* `B` [Fibonacci-Zahl (Fibonacci Number)](src/algorithms/math/fibonacci)
* `B` [Jump Game (Jump Game)](src/algorithms/uncategorized/jump-game)
* `B` [Eindeutige Pfade (Unique Paths)](src/algorithms/uncategorized/unique-paths)
* `B` [Regenterrassen (Rain Terraces)](src/algorithms/uncategorized/rain-terraces) - Auffangproblem für Regenwasser (trapping rain water problem) (dynamische Programmierung und Brute-Force-Versionen)
* `B` [Rekursive Treppe (Recursive Staircase)](src/algorithms/uncategorized/recursive-staircase) - Zählen der Anzahl der Wege, die nach oben führen (4 Lösungen)
* `B` [Inhaltsabhängige Bildverzerrung (Seam Carving)](src/algorithms/image-processing/seam-carving) - Algorithmus zur inhaltsabhängigen Bildgrößenänderung
* `A` [Levenshtein-Distanz (Levenshtein Distance)](src/algorithms/string/levenshtein-distance) - Minimaler Editierabstand zwischen zwei Sequenzen
* `A` [Problem der längsten gemeinsamen Teilsequenz (Longest Common Subsequence)](src/algorithms/sets/longest-common-subsequence) (LCS)
* `A` [Längstes häufiges Teilzeichenfolgenproblem (Longest Common Substring)](src/algorithms/string/longest-common-substring)
* `A` [Längste gemeinsame Teilsequenz (Longest Increasing Subsequence)](src/algorithms/sets/longest-increasing-subsequence)
* `A` [Der kürzeste gemeinsame String (Shortest Common Supersequence)](src/algorithms/sets/shortest-common-supersequence)
* `A` [Rucksackproblem (0/1 Knapsack Problem)](src/algorithms/sets/knapsack-problem)
* `A` [Ganzzahlige Partitionierung (Integer Partition)](src/algorithms/math/integer-partition)
* `A` [Das Maximum-Subarray Problem (Maximum Subarray)](src/algorithms/sets/maximum-subarray)
* `A` [Bellman-Ford-Algorithmus (Bellman-Ford Algorithm)](src/algorithms/graph/bellman-ford) - Finden der kürzesten Wege zu allen Knoten des Graphen von einem einzelnen Knotenpunkt aus
* `A` [Algorithmus von Floyd und Warshall (Floyd-Warshall Algorithm)](src/algorithms/graph/floyd-warshall) - Die kürzesten Wege zwischen allen Knotenpaaren finden
* `A` [Regulärer Ausdruck (Regular Expression Matching)](src/algorithms/string/regular-expression-matching)
* **Zurückverfolgung** - Ähnlich wie bei Brute-Force versuchen Sie, alle möglichen Lösungen zu generieren, aber jedes Mal, wenn Sie die nächste Lösung generieren, testen Sie, ob sie alle Bedingungen erfüllt, und fahren erst dann mit der Generierung weiterer Lösungen fort. Andernfalls gehen Sie zurück und nehmen einen anderen Weg, um eine Lösung zu finden. Normalerweise wird das DFS-Traversal des Zustandsraums verwendet.
* `B` [Jump Game (Jump Game)](src/algorithms/uncategorized/jump-game)
* `B` [Eindeutige Pfade (Unique Paths)](src/algorithms/uncategorized/unique-paths)
* `A` [Potenzmenge (Power Set)](src/algorithms/sets/power-set) - Alle Teilmengen einer Menge
* `A` [Hamiltonkreisproblem (Hamiltonian Cycle)](src/algorithms/graph/hamiltonian-cycle) - Jeden Eckpunkt genau einmal durchlaufen.
* `A` [Damenproblem (N-Queens Problem)](src/algorithms/uncategorized/n-queens)
* `A` [Springerproblem (Knight's Tour)](src/algorithms/uncategorized/knight-tour)
* `A` [Kombinationssumme (Combination Sum)](src/algorithms/sets/combination-sum) - Alle Kombinationen finden, die eine bestimmte Summe bilden
* **Verzweigung & Bindung** - Merkt sich die Lösung mit den niedrigsten Kosten, die in jeder Phase der Backtracking-Suche gefunden wurde, und verwendet die Kosten der bisher gefundenen Lösung mit den niedrigsten Kosten als untere Schranke für die Kosten einer Lösung des Problems mit den geringsten Kosten, um Teillösungen zu verwerfen, deren Kosten größer sind als die der bisher gefundenen Lösung mit den niedrigsten Kosten. Normalerweise wird das BFS-Traversal in Kombination mit dem DFS-Traversal des Zustandsraumbaums verwendet.
## So verwendest du dieses Repository
**Alle Abhängigkeiten installieren**
```
npm install
```
**ESLint ausführen**
You may want to run it to check code quality.
```
npm run lint
```
**Alle Tests ausführen**
```
npm test
```
**Tests nach Namen ausführen**
```
npm test -- 'LinkedList'
```
**Fehlerbehebung**
Falls das Linting oder Testen fehlschlägt, versuche, den Ordner "node_modules" zu löschen und die npm-Pakete neu zu installieren:
```
rm -rf ./node_modules
npm i
```
**Spielwiese**
Du kannst mit Datenstrukturen und Algorithmen in der Datei `./src/playground/playground.js` herumspielen und
dir in dieser Datei Tests schreiben `./src/playground/__test__/playground.test.js`.
Dann führe einfach folgenden Befehl aus, um zu testen, ob dein Spielwiesencode wie erwartet funktioniert:
```
npm test -- 'playground'
```
## Nützliche Informationen
### Referenzen
[▶ Datenstrukturen und Algorithmen auf YouTube(Englisch)](https://www.youtube.com/playlist?list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8)
### O-Notation (_Big O Notation_)
Die O-Notation wird verwendet, um Algorithmen danach zu klassifizieren, wie ihre Laufzeit oder ihr Platzbedarf mit zunehmender Eingabegröße wächst. In der folgenden Tabelle finden Sie die häufigsten Wachstumsordnungen von Algorithmen, die in Big-O-Notation angegeben sind.

Quelle: [Big O Cheat Sheet](http://bigocheatsheet.com/).
Nachfolgend finden Sie eine Liste einiger der am häufigsten verwendeten Big O-Notationen und deren Leistungsvergleiche für unterschiedliche Größen der Eingabedaten.
| Big O Notation | Berechnungen für 10 Elemente | Berechnungen für 100 Elemente | Berechnungen für 1000 Elemente |
| -------------- | ---------------------------- | ----------------------------- | ------------------------------ |
| **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 |
### Komplexität von Datenstrukturoperationen
| Datenstruktur | Zugriff auf | Suche | Einfügen | Löschung | Kommentare |
| ---------------------- | :---------: | :----: | :------: | :------: | :-------------------------------------------------------------- |
| **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 | Im Falle einer perfekten Hash-Funktion wären die Kosten O(1) |
| **Binary Search Tree** | n | n | n | n | Im Falle eines ausgeglichenen Baumes wären die Kosten 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 | - | Falschpostive sind bei der Suche möglichen |
### Komplexität von Array-Sortieralgorithmen
| Name | Bester | Durchschnitt | Schlechtester | Speicher | Stabil | Kommentar |
| ------------------ | :-----------: | :---------------------: | :-------------------------: | :------: | :----: | :------------------------------------------------------------------------- |
| **Bubble sort** | n | n<sup>2</sup> | n<sup>2</sup> | 1 | JA | |
| **Insertion sort** | n | n<sup>2</sup> | n<sup>2</sup> | 1 | Ja | |
| **Selection sort** | n<sup>2</sup> | n<sup>2</sup> | n<sup>2</sup> | 1 | Nein | |
| **Heap sort** | n log(n) | n log(n) | n log(n) | 1 | Nein | |
| **Merge sort** | n log(n) | n log(n) | n log(n) | n | Ja | |
| **Quick sort** | n log(n) | n log(n) | n<sup>2</sup> | log(n) | Nein | Quicksort wird normalerweise in-place mit O(log(n)) Stapelplatz ausgeführt |
| **Shell sort** | n log(n) | abhängig von Spaltfolge | n (log(n))<sup>2</sup> | 1 | Nein | |
| **Counting sort** | n + r | n + r | n + r | n + r | Ja | r - größte Zahl im Array |
| **Radix sort** | n \* k | n \* k | n \* k | n + k | Ja | k - Länge des längsten Schlüssels |
## Projekt-Unterstützer
> Du kannst dieses Projekt unterstützen über ❤️️ [GitHub](https://github.com/sponsors/trekhleb) or ❤️️ [Patreon](https://www.patreon.com/trekhleb).
[Leute, die dieses Projekt unterstützen](https://github.com/trekhleb/javascript-algorithms/blob/master/BACKERS.md) `∑ = 0`
> ℹ️ A few more [projects](https://trekhleb.dev/projects/) and [articles](https://trekhleb.dev/blog/) about JavaScript and algorithms on [trekhleb.dev](https://trekhleb.dev)
================================================
FILE: README.es-ES.md
================================================
# Algoritmos y Estructuras de Datos en JavaScript
[](https://github.com/trekhleb/javascript-algorithms/actions?query=workflow%3ACI+branch%3Amaster)
[](https://codecov.io/gh/trekhleb/javascript-algorithms)
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
enlaces para lecturas adicionales (incluyendo algunas a vídeos de YouTube).
_Léelo en otros idiomas:_
[_English_](https://github.com/trekhleb/javascript-algorithms/),
[_简体中文_](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),
[_Português_](README.pt-BR.md),
[_Русский_](README.ru-RU.md),
[_Türk_](README.tr-TR.md),
[_Italiana_](README.it-IT.md),
[_Bahasa Indonesia_](README.id-ID.md),
[_Українська_](README.uk-UA.md),
[_Arabic_](README.ar-AR.md),
[_Tiếng Việt_](README.vi-VN.md),
[_Deutsch_](README.de-DE.md),
[_Uzbek_](README.uz-UZ.md)
[_עברית_](README.he-IL.md)
## Estructuras de Datos
Una estructura de datos es una forma particular de organizar y almacenar datos en un ordenador para que puedan accederse
y modificarse de forma eficiente. Más concretamente, una estructura de datos es un conjunto de valores
de datos, las relaciones entre ellos y las funciones u operaciones que se pueden aplicar a
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)
## Algoritmos
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` [Sucesión 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` [Algoritmo π 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` [Algoritmo 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
* **Criptografía**
* `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` [Algoritmo 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 Límites** - 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
**Instalar las dependencias**
```
npm install
```
**Correr ESLint**
Es posible que desee ejecutarlo para comprobar la calidad del código.
```
npm run lint
```
**Correr los tests**
```
npm test
```
**Correr tests por nombre**
```
npm test -- 'LinkedList'
```
**Campo de juegos**
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:
```
npm test -- 'playground'
```
## Información útil
### Referencias
[▶ Estructuras de datos y algoritmos en YouTube](https://www.youtube.com/playlist?list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8)
### Notación O Grande
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
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 |
| ----------------- | -------------------------- | --------------------------- | ---------------------------- |
| **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 |
### Complejidad de las operaciones de estructuras de datos
| Estructura de Datos | Accesso | Busqueda | Inserción | Borrado | Comentarios |
| ------------------------------ | :-----: | :------: | :-------: | :-----: | :-------------------------------------------------------------- |
| **Colección** | 1 | n | n | n | |
| **Stack** | n | n | 1 | 1 | |
| **Cola** | n | n | 1 | 1 | |
| **Lista enlazada** | n | n | 1 | 1 | |
| **Tabla hash** | - | n | n | n | En caso de función hash perfecta los costos serían O(1) |
| **Búsqueda por Árbol binario** | n | n | n | n | En el caso de un árbol equilibrado, los costos serían O(log(n)) |
| **Árbol B** | log(n) | log(n) | log(n) | log(n) | |
| **Árbol Rojo-Negro** | log(n) | log(n) | log(n) | log(n) | |
| **Árbol AVL** | log(n) | log(n) | log(n) | log(n) | |
| **Filtro de Bloom** | - | 1 | 1 | - | Falsos positivos son posibles durante la búsqueda |
### Complejidad de algoritmos de ordenamiento de arreglos
| Nombre | Mejor | Promedio | Pero | Memorya | Estable | Comentarios |
| -------------------------------- | :-----------: | :---------------------: | :-------------------------: | :-----: | :-----: | :------------------------------------------------------------ |
| **Ordenamiento de burbuja** | n | n<sup>2</sup> | n<sup>2</sup> | 1 | Si | |
| **Ordenamiento por inserción** | n | n<sup>2</sup> | n<sup>2</sup> | 1 | Si | |
| **Ordenamiento por selección** | n<sup>2</sup> | n<sup>2</sup> | n<sup>2</sup> | 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) | n<sup>2</sup> | 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))<sup>2</sup> | 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 |
> ℹ️ Algunos otros [proyectos](https://trekhleb.dev/projects/) y [artículos](https://trekhleb.dev/blog/) sobre JavaScript y algoritmos en [trekhleb.dev](https://trekhleb.dev)
================================================
FILE: README.fr-FR.md
================================================
# Algorithmes et Structures de Données en JavaScript
[](https://github.com/trekhleb/javascript-algorithms/actions?query=workflow%3ACI+branch%3Amaster)
[](https://codecov.io/gh/trekhleb/javascript-algorithms)
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
complément d'informations.
_Lisez ceci dans d'autres langues:_
[_English_](https://github.com/trekhleb/javascript-algorithms/),
[_简体中文_](README.zh-CN.md),
[_繁體中文_](README.zh-TW.md),
[_한국어_](README.ko-KR.md),
[_日本語_](README.ja-JP.md),
[_Polski_](README.pl-PL.md),
[_Español_](README.es-ES.md),
[_Português_](README.pt-BR.md),
[_Русский_](README.ru-RU.md),
[_Türk_](README.tr-TR.md),
[_Italiana_](README.it-IT.md),
[_Bahasa Indonesia_](README.id-ID.md),
[_Українська_](README.uk-UA.md),
[_Arabic_](README.ar-AR.md),
[_Tiếng Việt_](README.vi-VN.md),
[_Deutsch_](README.de-DE.md),
[_Uzbek_](README.uz-UZ.md)
[_עברית_](README.he-IL.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
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)
## 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
une séquence d'opérations.
`B` - Débutant, `A` - Avancé
### Algorithmes par topic
- **Math**
- `B` [Manipulation de Bit](src/algorithms/math/bits/README.fr-FR.md) - définir/obtenir/mettre à jour/effacer les bits, multiplication/division par deux, négativiser etc.
- `B` [Factorielle](src/algorithms/math/factorial/README.fr-FR.md)
- `B` [Nombre de Fibonacci](src/algorithms/math/fibonacci/README.fr-FR.md)
- `B` [Test de Primalité](src/algorithms/math/primality-test) (méthode du test de division)
- `B` [Algorithme d'Euclide](src/algorithms/math/euclidean-algorithm/README.fr-FR.md) - 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)
- `B` [Nombre complexe](src/algorithms/math/complex-number/README.fr-FR.md) - nombres complexes et opérations de bases
- `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
- `B` [Exponentiation rapide](src/algorithms/math/fast-powering/README.fr-FR.md)
- `A` [Transformée de Fourier Discrète](src/algorithms/math/fourier-transform/README.fr-FR.md) - décomposer une fonction du temps (un signal) en fréquences qui la composent
- **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
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.
## Comment utiliser ce dépôt
**Installer toutes les dépendances**
```
npm install
```
**Exécuter ESLint**
Vous pouvez l'installer pour tester la qualité du code.
```
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
tests dans file `./src/playground/__test__/playground.test.js`.
Vous pourrez alors simplement exécuter la commande suivante afin de tester si
votre code fonctionne comme escompté
```
npm test -- 'playground'
```
## Informations Utiles
### Références
[▶ Structures de Données et Algorithmes sur YouTube](https://www.youtube.com/playlist?list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8)
### Notation Grand O
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
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 |
### 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 |
### Complexité des Algorithmes de Tri de Liste
| Nom | Meilleur | Moyenne | Pire | Mémoire | Stable | Commentaires |
| ----------------- | :-----------: | :--------------------: | :-------------------------: | :-----: | :----: | :----------------------------------------------------------------------------------- |
| **Tri Bulle** | n | n<sup>2</sup> | n<sup>2</sup> | 1 | Oui | |
| **Tri Insertion** | n | n<sup>2</sup> | n<sup>2</sup> | 1 | Oui | |
| **Tri Sélection** | n<sup>2</sup> | n<sup>2</sup> | n<sup>2</sup> | 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) | n<sup>2</sup> | 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))<sup>2</sup> | 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 |
> ℹ️ A few more [projects](https://trekhleb.dev/projects/) and [articles](https://trekhleb.dev/blog/) about JavaScript and algorithms on [trekhleb.dev](https://trekhleb.dev)
================================================
FILE: README.he-IL.md
================================================
# אלגוריתמים ומבני נתונים ב-JavaScript
[](https://github.com/trekhleb/javascript-algorithms/actions?query=workflow%3ACI+branch%3Amaster)
[](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),
[_Türkçe_](README.tr-TR.md),
[_Italiana_](README.it-IT.md),
[_Bahasa Indonesia_](README.id-ID.md),
[_Українська_](README.uk-UA.md),
[_Arabic_](README.ar-AR.md),
[_Tiếng Việt_](README.vi-VN.md),
[_Deutsch_](README.de-DE.md),
[_Uzbek_](README.uz-UZ.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` [עץ אדום-שחור](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) (מכוון ולא מכוון)
* `A` [קבוצה מופרדת](src/data-structures/disjoint-set) - מבנה נתונים של איחוד-מציאה או מיזוג-מציאה
* `A` [מסנן בלום](src/data-structures/bloom-filter)
* `A` [מטמון LRU](src/data-structures/lru-cache/) - מטמון פחות שימוש לאחרונה (LRU)
## אלגוריתמים
אלגוריתם הוא מפרט חד משמעי כיצד לפתור סוג של בעיות. זוהי קבוצה של כללים המגדירים במדויק רצף של פעולות.
`B` - מתחיל, `A` - מתקדם
### אלגוריתמים לפי נושא
* **מתמטיקה**
* `B` [מניפולציה על ביטים](src/algorithms/math/bits) - קביעה/עדכון/ניקוי ביטים, הכפלה/חילוק ב-2, הפיכה לשלילי וכו'
* `B` [נקודה צפה בינארית](src/algorithms/math/binary-floating-point) - ייצוג בינארי של מספרים בנקודה צפה
* `B` [פקטוריאל](src/algorithms/math/factorial)
* `B` [מספר פיבונאצ'י](src/algorithms/math/fibonacci) - גרסאות קלאסיות וסגורות
* `B` [גורמים ראשוניים](src/algorithms/math/prime-factors) - מציאת גורמים ראשוניים וספירתם באמצעות משפט הארדי-רמנוג'אן
* `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` [האם חזקה של שתיים](src/algorithms/math/is-power-of-two) - בדיקה אם מספר הוא חזקה של שתיים (אלגוריתמים נאיביים וביטיים)
* `B` [משולש פסקל](src/algorithms/math/pascal-triangle)
* `B` [מספר מרוכב](src/algorithms/math/complex-number) - מספרים מרוכבים ופעולות בסיסיות עליהם
* `B` [רדיאן ומעלות](src/algorithms/math/radian) - המרה מרדיאנים למעלות ובחזרה
* `B` [חזקה מהירה](src/algorithms/math/fast-powering)
* `B` [שיטת הורנר](src/algorithms/math/horner-method) - הערכת פולינום
* `B` [מטריצות](src/algorithms/math/matrix) - מטריצות ופעולות בסיסיות על מטריצות (כפל, טרנספוזיציה וכו')
* `B` [מרחק אוקלידי](src/algorithms/math/euclidean-distance) - מרחק בין שתי נקודות/וקטורים/מטריצות
* `A` [חלוקת מספר שלם](src/algorithms/math/integer-partition)
* `A` [שורש ריבועי](src/algorithms/math/square-root) - שיטת ניוטון
* `A` [אלגוריתם π של ליו הוי](src/algorithms/math/liu-hui) - חישובי π מקורבים על בסיס N-גונים
* `A` [התמרת פורייה הבדידה](src/algorithms/math/fourier-transform) - פירוק פונקציה של זמן (אות) לתדרים המרכיבים אותה
* **קבוצות**
* `B` [מכפלה קרטזית](src/algorithms/sets/cartesian-product) - מכפלה של מספר קבוצות
* `B` [ערבוב פישר-ייטס](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) גרסאות
* `A` [סכום צירוף](src/algorithms/sets/combination-sum) - מציאת כל הצירופים שיוצרים סכום ספציפי
* **מחרוזות**
* `B` [מרחק המינג](src/algorithms/string/hamming-distance) - מספר העמדות שבהן הסמלים שונים
* `B` [פלינדרום](src/algorithms/string/palindrome) - בדיקה אם המחרוזת זהה בקריאה לאחור
* `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)
* **חיפושים**
* `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) - יישומים במקום ולא במקום
* `B` [מיון צדפות](src/algorithms/sorting/shell-sort)
* `B` [מיון ספירה](src/algorithms/sorting/counting-sort)
* `B` [מיון בסיס](src/algorithms/sorting/radix-sort)
* `B` [מיון דלי](src/algorithms/sorting/bucket-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) - אלגוריתם טרג'ן (מבוסס DFS)
* `A` [גשרים](src/algorithms/graph/bridges) - אלגוריתם מבוסס DFS
* `A` [מסלול ומעגל אוילר](src/algorithms/graph/eulerian-path) - אלגוריתם פלרי - ביקור בכל קשת בדיוק פעם אחת
* `A` [מעגל המילטון](src/algorithms/graph/hamiltonian-cycle) - ביקור בכל קודקוד בדיוק פעם אחת
* `A` [רכיבים קשירים חזק](src/algorithms/graph/strongly-connected-components) - אלגוריתם קוסרג'ו
* `A` [בעיית הסוכן הנוסע](src/algorithms/graph/travelling-salesman) - המסלול הקצר ביותר האפשרי שמבקר בכל עיר וחוזר לעיר המוצא
* **הצפנה**
* `B` [גיבוב פולינומי](src/algorithms/cryptography/polynomial-hash) - פונקציית גיבוב מתגלגלת המבוססת על פולינום
* `B` [צופן גדר מסילה](src/algorithms/cryptography/rail-fence-cipher) - אלגוריתם הצפנת טרנספוזיציה להצפנת הודעות
* `B` [צופן קיסר](src/algorithms/cryptography/caesar-cipher) - צופן החלפה פשוט
* `B` [צופן היל](src/algorithms/cryptography/hill-cipher) - צופן החלפה המבוסס על אלגברה לינארית
* **למידת מכונה**
* `B` [NanoNeuron](https://github.com/trekhleb/nano-neuron) - 7 פונקציות JS פשוטות שמדגימות כיצד מכונות יכולות ללמוד באמת (תפוצה קדימה/אחורה)
* `B` [k-NN](src/algorithms/ml/knn) - אלגוריתם סיווג k-השכנים הקרובים ביותר
* `B` [k-Means](src/algorithms/ml/k-means) - אלגוריתם אשכול k-Means
* **עיבוד תמונה**
* `B` [Seam Carving](src/algorithms/image-processing/seam-carving) - אלגוריתם שינוי גודל תמונה מודע תוכן
* **סטטיסטיקה**
* `B` [משקל אקראי](src/algorithms/statistics/weighted-random) - בחירת פריט אקראי מהרשימה על בסיס משקלי הפריטים
* **אלגוריתמים אבולוציוניים**
* `A` [אלגוריתם גנטי](https://github.com/trekhleb/self-parking-car-evolution) - דוגמה לאופן שבו ניתן ליישם אלגוריתם גנטי לאימון מכוניות בחניה עצמית
* **לא מסווג**
* `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) - דוגמאות למעקב לאחור, תכנות דינמי ומבוססות על משולש פסקל
* `B` [מדרגות גשם](src/algorithms/uncategorized/rain-terraces) - בעיית לכידת מי גשם (גרסאות תכנות דינמי וכוח ברוטלי)
* `B` [מדרגות רקורסיביות](src/algorithms/uncategorized/recursive-staircase) - ספירת מספר הדרכים להגיע לראש (4 פתרונות)
* `B` [הזמן הטוב ביותר לקנות ולמכור מניות](src/algorithms/uncategorized/best-time-to-buy-sell-stocks) - דוגמאות לחלוקה וכיבוש ומעבר אחד
* `A` [בעיית N-המלכות](src/algorithms/uncategorized/n-queens)
* `A` [סיור הפרש](src/algorithms/uncategorized/knight-tour)
### אלגוריתמים לפי פרדיגמה
פרדיגמה אלגוריתמית היא שיטה או גישה כללית המונחת בבסיס התכנון של מחלקת אלגוריתמים. זוהי הפשטה גבוהה יותר מהמושג של אלגוריתם, בדיוק כפי שאלגוריתם הוא הפשטה גבוהה יותר מתוכנית מחשב.
* **כוח ברוטלי** - בודק את כל האפשרויות ובוחר את הפתרון הטוב ביותר
* `B` [חיפוש לינארי](src/algorithms/search/linear-search)
* `B` [מדרגות גשם](src/algorithms/uncategorized/rain-terraces) - בעיית לכידת מי גשם
* `B` [מדרגות רקורסיביות](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` [אלגוריתם דייקסטרה](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/math/matrix) - יצירה ומעבר על מטריצות בצורות שונות
* `B` [משחק הקפיצות](src/algorithms/uncategorized/jump-game)
* `B` [חזקה מהירה](src/algorithms/math/fast-powering)
* `B` [הזמן הטוב ביותר לקנות ולמכור מניות](src/algorithms/uncategorized/best-time-to-buy-sell-stocks) - דוגמאות לחלוקה וכיבוש ומעבר אחד
* `A` [תמורות](src/algorithms/sets/permutations) (עם ובלי חזרות)
* `A` [צירופים](src/algorithms/sets/combinations) (עם ובלי חזרות)
* `A` [תת-מערך מקסימלי](src/algorithms/sets/maximum-subarray)
* **תכנות דינמי** - בניית פתרון באמצעות תת-פתרונות שנמצאו קודם לכן
* `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) - ספירת מספר הדרכים להגיע לראש
* `B` [Seam Carving](src/algorithms/image-processing/seam-carving) - אלגוריתם שינוי גודל תמונה מודע תוכן
* `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)
* **מעקב לאחור** - בדומה לכוח ברוטלי, מנסה לייצר את כל הפתרונות האפשריים, אך בכל פעם שאתה מייצר פתרון הבא אתה בודק אם הוא עומד בכל התנאים, ורק אז ממשיך לייצר פתרונות הבאים. אחרת, חוזר אחורה, והולך בנתיב אחר של מציאת פתרון. בדרך כלל מעבר 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) - ביקור בכל קודקוד בדיוק פעם אחת
* `A` [בעיית N-המלכות](src/algorithms/uncategorized/n-queens)
* `A` [סיור הפרש](src/algorithms/uncategorized/knight-tour)
* `A` [סכום צירוף](src/algorithms/sets/combination-sum) - מציאת כל הצירופים שיוצרים סכום ספציפי
* **סניף וחסום** - זוכר את הפתרון בעלות הנמוכה ביותר שנמצא בכל שלב של החיפוש המעקב לאחור, ומשתמש בעלות של הפתרון בעלות הנמוכה ביותר שנמצא עד כה כגבול תחתון על העלות של פתרון בעלות מינימלית לבעיה, על מנת לפסול פתרונות חלקיים עם עלויות גדולות יותר מהפתרון בעלות הנמוכה ביותר שנמצא עד כה. בדרך כלל מעבר BFS בשילוב עם מעבר DFS של עץ מרחב המצבים משמש.
## כיצד להשתמש במאגר זה
**התקנת כל התלויות**
```
npm install
```
**הרצת ESLint**
ייתכן שתרצה להריץ אותו כדי לבדוק את איכות הקוד.
```
npm run lint
```
**הרצת כל הבדיקות**
```
npm test
```
**הרצת בדיקות לפי שם**
```
npm test -- 'LinkedList'
```
**פתרון בעיות**
אם הלינטינג או הבדיקות נכשלים, נסה למחוק את התיקייה `node_modules` ולהתקין מחדש את חבילות npm:
```
rm -rf ./node_modules
npm i
```
בנוסף, ודא שאתה משתמש בגרסת Node נכונה (`>=16`). אם אתה משתמש ב-[nvm](https://github.com/nvm-sh/nvm) לניהול גרסאות Node, תוכל להריץ `nvm use` מתיקיית השורש של הפרויקט והגרסה הנכונה תיבחר.
**שטח משחקים**
אתה יכול לשחק עם מבני נתונים ואלגוריתמים בקובץ `./src/playground/playground.js` ולכתוב
בדיקות עבורו ב-`./src/playground/__test__/playground.test.js`.
לאחר מכן פשוט הרץ את הפקודה הבאה כדי לבדוק אם קוד שטח המשחקים שלך עובד כמצופה:
```
npm test -- 'playground'
```
## מידע שימושי
### הפניות
- [▶ מבני נתונים ואלגוריתמים ב-YouTube](https://www.youtube.com/playlist?list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8)
- [✍🏻 סקיצות של מבני נתונים](https://okso.app/showcase/data-structures)
### סימון ה-O הגדול
סימון *ה-O הגדול* משמש לסיווג אלגוריתמים לפי כיצד זמן הריצה או דרישות המרחב שלהם גדלים ככל שגודל הקלט גדל.
בתרשים שלהלן תוכל למצוא את הסדרים הנפוצים ביותר של צמיחת אלגוריתמים המצוינים בסימון ה-O הגדול.

מקור: [Big O Cheat Sheet](http://bigocheatsheet.com/).
להלן רשימה של כמה מסימוני ה-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 |
### מורכבות פעולות מבני נתונים
| מבנה נתונים | גישה | חיפוש | הכנסה | מחיקה | הערות |
| --------------------- | :-----: | :-----: | :-----: | :-----: | :------ |
| **מערך** | 1 | n | n | n | |
| **מחסנית** | n | n | 1 | 1 | |
| **תור** | n | n | 1 | 1 | |
| **רשימה מקושרת** | n | n | 1 | n | |
| **טבלת גיבוב** | - | 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<sup>2</sup> | n<sup>2</sup> | 1 | כן | |
| **מיון הכנסה** | n | n<sup>2</sup> | n<sup>2</sup> | 1 | כן | |
| **מיון בחירה** | n<sup>2</sup> | n<sup>2</sup> | n<sup>2</sup> | 1 | לא | |
| **מיון ערימה** | n log(n) | n log(n) | n log(n) | 1 | לא | |
| **מיון מיזוג** | n log(n) | n log(n) | n log(n) | n | כן | |
| **מיון מהיר** | n log(n) | n log(n) | n<sup>2</sup> | log(n) | לא | מיון מהיר בדרך כלל מבוצע במקום עם O(log(n)) שטח מחסנית |
| **מיון צדפות** | n log(n) | תלוי ברצף הפער | n (log(n))<sup>2</sup> | 1 | לא | |
| **מיון ספירה** | n + r | n + r | n + r | n + r | כן | r - המספר הגדול ביותר במערך |
| **מיון בסיס** | n * k | n * k | n * k | n + k | כן | k - אורך המפתח הארוך ביותר |
## תומכי הפרויקט
> אתה יכול לתמוך בפרויקט זה דרך ❤️️ [GitHub](https://github.com/sponsors/trekhleb) או ❤️️ [Patreon](https://www.patreon.com/trekhleb).
[אנשים שתומכים בפרויקט זה](https://github.com/trekhleb/javascript-algorithms/blob/master/BACKERS.md) `∑ = 1`
## מחבר
[@trekhleb](https://trekhleb.dev)
כמה [פרויקטים](https://trekhleb.dev/projects/) ו[מאמרים](https://trekhleb.dev/blog/) נוספים על JavaScript ואלגוריתמים ב-[trekhleb.dev](https://trekhleb.dev)* `B` [משחק הקפיצות](src/algorithms/uncategor * `B` [חיפוש בינארי](src/algorithms
================================================
FILE: README.id-ID.md
================================================
# Algoritme dan Struktur Data Javascript
[](https://github.com/trekhleb/javascript-algorithms/actions?query=workflow%3ACI+branch%3Amaster)
[](https://codecov.io/gh/trekhleb/javascript-algorithms)
Repositori ini berisi contoh-contoh algoritme dan struktur data yang populer menggunakan JavaScript.
Setiap algoritma dan struktur data memiliki README-nya tersendiri dengan penjelasan yang berkaitan dan tautan untuk bacaan lebih lanjut (termasuk tautan menuju video YouTube).
_Baca ini dalam bahasa yang lain:_
[_English_](https://github.com/trekhleb/javascript-algorithms/),
[_简体中文_](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),
[_Türk_](README.tr-TR.md),
[_Italiana_](README.it-IT.md),
[_Українська_](README.uk-UA.md),
[_Arabic_](README.ar-AR.md),
[_Tiếng Việt_](README.vi-VN.md),
[_Deutsch_](README.de-DE.md),
[_Uzbek_](README.uz-UZ.md)
[_עברית_](README.he-IL.md)
## Struktur Data
Struktur data adalah cara tertentu untuk mengatur dan menyimpan data dalam komputer sehingga dapat diakses dan diubah secara efisien. Lebih tepatnya, struktur data adalah kumpulan dari nilai data, relasi di antara data-data, dan fungsi atau operasi yang dapat diterapkan pada data.
`P` - Pemula, `L` - Lanjutan
- `P` [Senarai Berantai](src/data-structures/linked-list)
- `P` [Senarai Berantai Ganda](src/data-structures/doubly-linked-list)
- `P` [Antrean](src/data-structures/queue)
- `P` [Tumpukan](src/data-structures/stack)
- `P` [Tabel Hash](src/data-structures/hash-table)
- `P` [_Heap_](src/data-structures/heap) - versi _heap_ maksimum dan minimum
- `P` [Antrean Prioritas](src/data-structures/priority-queue)
- `L` [_Trie_](src/data-structures/trie)
- `L` [Pohon](src/data-structures/tree)
- `L` [Pohon Telusur Biner](src/data-structures/tree/binary-search-tree)
- `L` [_AVL Tree_](src/data-structures/tree/avl-tree)
- `L` [Pohon Merah Hitam](src/data-structures/tree/red-black-tree)
- `L` [_Segment Tree_](src/data-structures/tree/segment-tree) - dengan contoh min/max/sum range query
- `L` [Pohon Fenwick](src/data-structures/tree/fenwick-tree) (Binary Indexed Tree)
- `L` [Graf](src/data-structures/graph) (directed dan undirected)
- `L` [_Disjoint Set_](src/data-structures/disjoint-set)
- `L` [_Bloom Filter_](src/data-structures/bloom-filter)
## Algoritma
Algoritma adalah sebuah perincian yang jelas tentang cara untuk memecahkan suatu masalah. Ia adalah sekumpulan aturan yang menjelaskan secara tepat urutan-urutan dari sebuah operasi.
`P` - Pemula, `L` - Lanjutan
### Algoritma Berdasarkanan Topik
- **Matematika**
- `P` [Manipulasi Bit](src/algorithms/math/bits) - menetapkan/mendapatkan/memperbarui/menghapus bit, perkalian/pembagian dengan angka 2, membuat bilangan negatif dan lain-lain.
- `P` [Faktorial](src/algorithms/math/Faktorial)
- `P` [Bilangan Fibonacci](src/algorithms/math/fibonacci) - versi klasik dan bentuk tertutup
- `P` [Faktor Prima](src/algorithms/math/prime-factors) - menemukan faktor prima dan menghitungnya menggunakan teorema Hardy-Ramanujan
- `P` [Pengujian Bilangan Prima](src/algorithms/math/primality-test) (metode _trial division_)
- `P` [Algoritma Euclidean](src/algorithms/math/euclidean-algorithm) - menghitung Faktor Persekutuan Terbesar (FPB)
- `P` [_Least Common Multiple_](src/algorithms/math/least-common-multiple) (LCM)
- `P` [_Sieve of Eratosthenes_](src/algorithms/math/sieve-of-eratosthenes) - menemukan semua bilangan prima hingga batas yang ditentukan
- `P` [_Is Power of Two_](src/algorithms/math/is-power-of-two) - mengecek apakah sebuah bilangan adalah hasil dari pangkat dua (algoritma _naive_ dan _bitwise_)
- `P` [Segitiga Pascal](src/algorithms/math/pascal-triangle)
- `P` [Bilangan Kompleks](src/algorithms/math/complex-number) - bilangan kompleks dengan operasi dasarnya
- `P` [Radian & Derajat](src/algorithms/math/radian) - konversi radian ke derajat dan sebaliknya
- `P` [_Fast Powering_](src/algorithms/math/fast-powering)
- `P` [Metode Horner](src/algorithms/math/horner-method) - evaluasi polinomial
- `L` [Partisi Bilangan Bulat](src/algorithms/math/integer-partition)
- `L` [Akar Pangkat Dua](src/algorithms/math/square-root) - metode Newton
- `L` [Algoritma π Liu Hui](src/algorithms/math/liu-hui) - perkiraan perhitungan π berdasarkan segibanyak
- `L` [Transformasi Diskrit Fourier](src/algorithms/math/fourier-transform) - menguraikan fungsi waktu (sinyal) menjadi frekuensi yang menyusunnya
- **Himpunan**
- `P` [Produk Kartesian](src/algorithms/sets/cartesian-product) - hasil dari beberapa himpunan
- `P` [Pengocokan Fisher–Yates](src/algorithms/sets/fisher-yates) - permutasi acak dari sebuah urutan terhingga
- `L` [Himpunan Kuasa](src/algorithms/sets/power-set) - semua himpunan bagian dari sebuah himpunan
- `L` [Permutasi](src/algorithms/sets/permutations) (dengan dan tanpa pengulangan)
- `L` [Kombinasi](src/algorithms/sets/combinations) (dengan dan tanpa pengulangan)
- `L` [_Longest Common Subsequence_](src/algorithms/sets/longest-common-subsequence) (LCS)
- `L` [_Longest Increasing Subsequence_](src/algorithms/sets/longest-increasing-subsequence)
- `L` [_Shortest Common Supersequence_](src/algorithms/sets/shortest-common-supersequence) (SCS)
- `L` [Permasalahan Knapsack](src/algorithms/sets/knapsack-problem) - "0/1" dan yang tidak "dibatasi"
- `L` [Upalarik Maksimum](src/algorithms/sets/maximum-subarray) - "_Brute Force_" dan "Pemrograman Dinamis" versi Kadane
- `L` [_Combination Sum_](src/algorithms/sets/combination-sum) - menemukan semua kombinasi yang membentuk jumlah tertentu
- **String**
- `P` [Jarak Hamming](src/algorithms/string/hamming-distance) - jumlah posisi di mana ditemukan simbol-simbol yang berbeda
- `L` [Algoritma Jarak Levenshtein](src/algorithms/string/levenshtein-distance) - _edit distance_ minimum antara dua urutan
- `L` [Algoritma Knuth–Morris–Pratt](src/algorithms/string/knuth-morris-pratt) (Algoritma KMP) - pencarian substring (pencocokan pola)
- `L` [Algoritma Z](src/algorithms/string/z-algorithm) - pencarian substring (pencocokan pola)
- `L` [Algoritma Rabin Karp](src/algorithms/string/rabin-karp) - pencarian substring
- `L` [_Longest Common Substring_](src/algorithms/string/longest-common-substring)
- `L` [Pencocokan Ekspresi Reguler](src/algorithms/string/regular-expression-matching)
- **Pencarian**
- `P` [Pencarian Linier](src/algorithms/search/linear-search)
- `P` [Pencarian Lompat](src/algorithms/search/jump-search) (atau Block Search) - pencarian di larik tersortir
- `P` [Pencarian Biner](src/algorithms/search/binary-search) - pencarian di larik tersortir
- `P` [Pencarian Interpolasi](src/algorithms/search/interpolation-search) - pencarian di larik tersortir yang terdistribusi seragam
- **Penyortiran**
- `P` [Sortir Gelembung](src/algorithms/sorting/bubble-sort)
- `P` [Sortir Seleksi](src/algorithms/sorting/selection-sort)
- `P` [Sortir Sisipan](src/algorithms/sorting/insertion-sort)
- `P` [Sortir _Heap_](src/algorithms/sorting/heap-sort)
- `P` [Sortir Gabungan](src/algorithms/sorting/merge-sort)
- `P` [Sortir Cepat](src/algorithms/sorting/quick-sort) - implementasi _in-place_ dan _non-in-place_
- `P` [Sortir Shell](src/algorithms/sorting/shell-sort)
- `P` [Sortir Perhitungan](src/algorithms/sorting/counting-sort)
- `P` [Sortir Akar](src/algorithms/sorting/radix-sort)
- **Senarai Berantai**
- `P` [Lintas Lurus](src/algorithms/linked-list/traversal)
- `P` [Lintas Terbalik](src/algorithms/linked-list/reverse-traversal)
- **Pohon**
- `P` [Pencarian Kedalaman Pertama](src/algorithms/tree/depth-first-search) (DFS)
- `P` [Pencarian Luas Pertama](src/algorithms/tree/breadth-first-search) (BFS)
- **Graf**
- `P` [Pencarian Kedalaman Pertama](src/algorithms/graph/depth-first-search) (DFS)
- `P` [Pencarian Luas Pertama](src/algorithms/graph/breadth-first-search) (BFS)
- `P` [Algoritma Kruskal](src/algorithms/graph/kruskal) - mencari rentang pohon minimum untuk graf tidak berarah berbobot
- `L` [Algoritma Dijkstra](src/algorithms/graph/dijkstra) - menemukan jalur terpendek ke semua sudut graf dari sudut tunggal
- `L` [Algoritma Bellman-Ford](src/algorithms/graph/bellman-ford) - menemukan jalur terpendek ke semua sudut graf dari sudut tunggal
- `L` [Algoritma Floyd-Warshall](src/algorithms/graph/floyd-warshall) - menemukan jalur terpendek antara semua pasangan sudut
- `L` [Mendeteksi Siklus](src/algorithms/graph/detect-cycle) - untuk graf berarah dan tidak berarah (berdasarkan versi DFS dan _Disjoint Set_)
- `L` [ALgoritma Prim](src/algorithms/graph/prim) - mencari rentang pohon minimum untuk graf tidak berarah berbobot
- `L` [Sortir Topologi](src/algorithms/graph/topological-sorting) - metode DFS
- `L` [Poin Artikulasi](src/algorithms/graph/articulation-points) - Algoritma Tarjan (berdasarkan DFS)
- `L` [Jembatan](src/algorithms/graph/bridges) - Algoritma berdasarkan DFS
- `L` [Jalur dan Sirkuit Eulerian](src/algorithms/graph/eulerian-path) - Algoritma Fleury - Mengunjungi setiap tepinya tepat satu kali
- `L` [Siklus Hamiltonian](src/algorithms/graph/hamiltonian-cycle) - mengunjungi setiap sudutnya tepat satu kali
- `L` [Komponen yang Terkoneksi dengan Kuat](src/algorithms/graph/strongly-connected-components) - Algoritma Kosaraju
- `L` [Permasalahan Penjual Keliling](src/algorithms/graph/travelling-salesman) - kemungkinan rute terpendek untuk mengunjungi setiap kota dan kembali lagi ke kota asal
- **Kriptografi**
- `P` [Polinomial Hash](src/algorithms/cryptography/polynomial-hash) - fungsi rolling hash berdasarkan polinomial
- `P` [Sandi Caesar](src/algorithms/cryptography/caesar-cipher) - sandi pengganti sederhana
- **Pembelajaran Mesin**
- `P` [NanoNeuron](https://github.com/trekhleb/nano-neuron) - 7 fungsi JS sederhana yang mengilustrasikan bagaimana mesin-mesin dapat benar-benar belajar (perambatan maju/mundur)
- **Tidak Dikategorikan**
- `P` [Menara Hanoi](src/algorithms/uncategorized/hanoi-tower)
- `P` [Perputaran Matriks Persegi](src/algorithms/uncategorized/square-matrix-rotation) - algoritma _in-place_
- `P` [Permainan Melompat](src/algorithms/uncategorized/jump-game) - runut-balik, pemrograman dinamis (atas ke bawah + bawah ke atas) and contoh-contoh _greedy_
- `P` [_Unique Paths_](src/algorithms/uncategorized/unique-paths) - runut-balik, pemrograman dinamis and contoh-contoh beradsarkan Segitiga Pascal
- `P` [_Rain Terraces_](src/algorithms/uncategorized/rain-terraces) - permasalahan _trapping rain water_ (versi pemrograman dinamis and _brute force_)
- `P` [Tangga Rekursif](src/algorithms/uncategorized/recursive-staircase) - menghitung jumlah cara untuk mencapai ke atas tangga (4 solusi)
- `L` [Permainan N-Queen](src/algorithms/uncategorized/n-queens)
- `L` [Permainan Knight's Tour](src/algorithms/uncategorized/knight-tour)
### Algoritma Berdasarkan Paradigma
Paradigma algoritmik adalah sebuah metode atau pendekatan umum yang mendasari desain sebuah tingkatan algoritma. Paradigma algoritmik merupakan abstraksi yang lebih tinggi dari gagasan sebuah algoritma, seperti halnya sebuah algoritma merupakan abstraksi yang lebih tinggi dari sebuah program komputer.
- **_Brute Force_** - melihat ke semua kemungkinan dan memilih solusi yang terbaik
- `P` [Pencarian Linier](src/algorithms/search/linear-search)
- `P` [_Rain Terraces_](src/algorithms/uncategorized/rain-terraces) - permasalahan _trapping rain water_
- `P` [Tangga Rekursif](src/algorithms/uncategorized/recursive-staircase) - menghitung jumlah cara untuk mencapai ke atas tangga
- `L` [Upalarik Maksimum](src/algorithms/sets/maximum-subarray)
- `L` [Permasalahan Penjual Keliling](src/algorithms/graph/travelling-salesman) - kemungkinan rute terpendek untuk mengunjungi setiap kota dan kembali lagi ke kota asal
- `L` [Transformasi Diskrit Fourier](src/algorithms/math/fourier-transform) - menguraikan fungsi waktu (sinyal) menjadi frekuensi yang menyusunnya
- **_Greedy_** - memilih pilihan terbaik pada saat ini tanpa mempertimbangkan masa yang akan datang
- `P` [Permainan Melompat](src/algorithms/uncategorized/jump-game)
- `L` [Permasalahan Knapsack yang Tidak Dibatasi](src/algorithms/sets/knapsack-problem)
- `L` [Algoritma Dijkstra](src/algorithms/graph/dijkstra) - menemukan jalur terpendek ke semua sudut graf dari sudut tunggal
- `L` [Algoritma Prim](src/algorithms/graph/prim) - mencari rentang pohon minimum untuk graf tidak berarah berbobot
- `L` [Algoritma Kruskal](src/algorithms/graph/kruskal) - mencari rentang pohon minimum untuk graf tidak berarah berbobot
- **Memecah dan Menaklukkan** - membagi masalah menjadi bagian-bagian yang kecil, lalu memcahkan bagian-bagian tersebut
- `P` [Pencarian Biner](src/algorithms/search/binary-search)
- `P` [Menara Hanoi](src/algorithms/uncategorized/hanoi-tower)
- `P` [Segitiga Pascal](src/algorithms/math/pascal-triangle)
- `P` [Algoritma Euclidean](src/algorithms/math/euclidean-algorithm) - menghitung Faktor Persekutuan Terbesar (FPB)
- `P` [Sortir Gabungan](src/algorithms/sorting/merge-sort)
- `P` [Sortir Cepat](src/algorithms/sorting/quick-sort)
- `P` [Pencarian Kedalaman Pertama untuk Pohon](src/algorithms/tree/depth-first-search) (DFS)
- `P` [Pencarian Kedalaman Pertama untuk Graf](src/algorithms/graph/depth-first-search) (DFS)
- `P` [Permainan Melompat](src/algorithms/uncategorized/jump-game)
- `P` [_Fast Powering_](src/algorithms/math/fast-powering)
- `L` [Permutasi](src/algorithms/sets/permutations) (dengan dan tanpa pengulangan)
- `L` [Kombinasi](src/algorithms/sets/combinations) (dengan dan tanpa pengulangan)
- **Pemrograman Dinamis** - membangun sebuah solusi menggunakan upasolusi yang ditemukan sebelumnya
- `P` [Bilangan Fibonacci](src/algorithms/math/fibonacci)
- `P` [Permainan Melompat](src/algorithms/uncategorized/jump-game)
- `P` [_Unique Paths_](src/algorithms/uncategorized/unique-paths)
- `P` [_Rain Terraces_](src/algorithms/uncategorized/rain-terraces) - permasalahan _trapping rain water_
- `P` [Tangga Rekursif](src/algorithms/uncategorized/recursive-staircase) - menghitung jumlah cara untuk mencapai ke atas tangga
- `L` [Algoritma Jarak Levenshtein](src/algorithms/string/levenshtein-distance) - _edit distance_ minimum antara dua urutan
- `L` [_Longest Common Subsquence_](src/algorithms/sets/longest-common-subsequence) (LCS)
- `L` [_Longest Common Substring_](src/algorithms/string/longest-common-substring)
- `L` [_Longest Increasing Subsequence_](src/algorithms/sets/longest-increasing-subsequence)
- `L` [_Shortest Common Supersequence_](src/algorithms/sets/shortest-common-supersequence)
- `L` [Permasalahan Knapsack 0/1](src/algorithms/sets/knapsack-problem)
- `L` [Partisi Bilangan Bulat](src/algorithms/math/integer-partition)
- `L` [Upalarik Maksimum](src/algorithms/sets/maximum-subarray)
- `L` [Algoritma Bellman-Ford](src/algorithms/graph/bellman-ford) - menemukan jalur terpendek ke semua sudut graf dari sudut tunggal
- `L` [Algoritma Floyd-Warshall](src/algorithms/graph/floyd-warshall) - menemukan jalur terpendek antara semua pasangan sudut
- `L` [Pencocokan Ekspresi Reguler](src/algorithms/string/regular-expression-matching)
- **Runut-balik** - sama halnya dengan _brute force_, algoritma ini mencoba untuk menghasilkan segala kemungkinan solusi, tetapi setiap kali anda menghasilkan solusi selanjutnya, anda akan menguji apakah solusi tersebut memenuhi semua kondisi dan setelah itu baru akan menghasilkan solusi berikutnya. Apabila tidak, maka akan merunut-balik dan mencari solusi di jalur yang berbeda. Biasanya menggunakan lintas DFS dari ruang keadaan.
- `P` [Permainan Melompat](src/algorithms/uncategorized/jump-game)
- `P` [_Unique Paths_](src/algorithms/uncategorized/unique-paths)
- `P` [Himpunan Kuasa](src/algorithms/sets/power-set) - semua himpunan bagian dari sebuah himpunan
- `L` [Siklus Hamiltonian](src/algorithms/graph/hamiltonian-cycle) - mengunjungi setiap sudutnya tepat satu kali
- `L` [Permainan N-Queen](src/algorithms/uncategorized/n-queens)
- `L` [Permainan Knight's Tour](src/algorithms/uncategorized/knight-tour)
- `L` [_Combination Sum_](src/algorithms/sets/combination-sum) - menemukan semua kombinasi yang membentuk jumlah tertentu
- **_Mencabang dan Membatasi_** - digunakan untuk membuang solusi parsial dengan biaya yang lebih besar dari solusi dengan biaya yang terendah yang ditemukan sejauh ini dengan cara mengingat solusi dengan biaya terendah yang ditemukan pada setiap tahap dari pencarian runut-balik dan menggunakan biaya dari solusi dengan biaya terendah sejauh ini sebagai batas bawah pada biaya dari solusi dengan biaya yang paling sedikit untuk permasalahannya. Biasanya menggunakan lintas BFS yang berkombinasi dengan lintas DFS dari pohon ruang keadaan.
## Cara menggunakan repositori ini
**Meng-_install_ semua dependensi**
```
npm install
```
**Menjalankan ESLint**
Anda dapat menjalankannya untuk memeriksa kualitas kode.
```
npm run lint
```
**Menjalankan semua tes**
```
npm test
```
**Menjalankan tes berdasarkan nama**
```
npm test -- 'LinkedList'
```
**_Playground_**
Anda dapat bermain dengan algoritma dan struktur data di _file_ `./src/playground/playground.js` dan menuliskan tesnya di `./src/playground/__test__/playground.test.js`.
Lalu, hanya tinggal menjalankan perintah berikut untuk mengetes apakah kode _playground_ anda bekerja sesuai dengan keinginan:
```
npm test -- 'playground'
```
## Informasi Bermanfaat
### Referensi
[▶ Algoritma dan Struktur Data di YouTube](https://www.youtube.com/playlist?list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8)
### Notasi _Big O_
Notasi _Big O_ digunakan untuk mengklasifikasikan algoritma berdasarkan durasi atau ruang yang dibutuhkan seiring bertambahnya _input_. Pada grafik dibawah, anda dapat menemukan urutan pertumbuhan yang paling umum dari algoritma yang ditentukan dalam notasi _Big O_.

Sumber: [Big O Cheat Sheet](http://bigocheatsheet.com/).
Di bawah ini adalah daftar dari beberapa notasi _Big O_ yang sering digunakan dan perbandingan kinerjanya terhadap berbagai ukuran _input data_.
| Notasi _Big O_ | Komputasi untuk 10 elemen | Komputasi untuk 100 elemen | Komputasi untuk 1000 elemen |
| -------------- | ------------------------- | -------------------------- | --------------------------- |
| **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 |
### Kompleksitas Operasi Struktur Data
| Struktur Data | Akses | Pencarian | Penyisipan | Penghapusan | Keterangan |
| -------------------------------------------- | :----: | :-------: | :--------: | :---------: | :------------------------------------------------------- |
| **Array (Larik)** | 1 | n | n | n | |
| **Stack (Tumpukan)** | n | n | 1 | 1 | |
| **Queue (Antrean)** | n | n | 1 | 1 | |
| **Linked List (Senarai Berantai)** | n | n | 1 | n | |
| **Hash Table** | - | n | n | n | Apabila fungsi hash sempurna, biayanya akan menjadi O(1) |
| **Binary Search Tree (Pohon Telusur Biner)** | n | n | n | n | Apabila pohon seimbang, biayanya akan menjadi O(log(n)) |
| **B-Tree** | log(n) | log(n) | log(n) | log(n) | |
| **Red-Black Tree (Pohon Merah-Hitam)** | log(n) | log(n) | log(n) | log(n) | |
| **AVL Tree** | log(n) | log(n) | log(n) | log(n) | |
| **Bloom Filter** | - | 1 | 1 | - | Positif palsu dimungkinkan saat pencarian |
### Kompleksitas Algoritma Sortir Larik
| Nama | Terbaik | Rata-rata | Terburuk | Memori | Stabil | Keterangan |
| -------------------------------------- | :-----------: | :--------------------------: | :-------------------------: | :----: | :----: | :-------------------------------------------------------------------------------- |
| **Bubble sort (Sortir Gelembung)** | n | n<sup>2</sup> | n<sup>2</sup> | 1 | Ya | |
| **Insertion sort (Sortir Sisipan)** | n | n<sup>2</sup> | n<sup>2</sup> | 1 | Ya | |
| **Selection sort (Sortir Seleksi)** | n<sup>2</sup> | n<sup>2</sup> | n<sup>2</sup> | 1 | Tidak | |
| **Heap sort (Sortir _Heap_)** | n log(n) | n log(n) | n log(n) | 1 | Tidak | |
| **Merge Sort (Sortir Gabungan)** | n log(n) | n log(n) | n log(n) | n | Ya | |
| **Quick sort (Sortir Cepat)** | n log(n) | n log(n) | n<sup>2</sup> | log(n) | Tidak | Sortir Cepat biasanya dilakukan secara _in-place_ dengan O(log(n)) ruang tumpukan |
| **Shell sort (Sortir Shell)** | n log(n) | tergantung pada jarak urutan | n (log(n))<sup>2</sup> | 1 | Tidak | |
| **Counting sort (Sortir Perhitungan)** | n + r | n + r | n + r | n + r | Ya | r - angka terbesar dalam larik |
| **Radix sort (Sortir Akar)** | n \* k | n \* k | n \* k | n + k | Ya | k - panjang dari kunci terpanjang |
## Pendukung Proyek
> Anda dapat mendukung proyek ini via ❤️️ [GitHub](https://github.com/sponsors/trekhleb) atau ❤️️ [Patreon](https://www.patreon.com/trekhleb).
[Orang-orang yang mendukung proyek ini](https://github.com/trekhleb/javascript-algorithms/blob/master/BACKERS.md) `∑ = 1`
> ℹ️ A few more [projects](https://trekhleb.dev/projects/) and [articles](https://trekhleb.dev/blog/) about JavaScript and algorithms on [trekhleb.dev](https://trekhleb.dev)
================================================
FILE: README.it-IT.md
================================================
# Algoritmi e Strutture Dati in Javascript
[](https://github.com/trekhleb/javascript-algorithms/actions?query=workflow%3ACI+branch%3Amaster)
[](https://codecov.io/gh/trekhleb/javascript-algorithms)
Questa repository contiene esempi in Javascript dei più popolari algoritmi e strutture dati .
Ogni algortimo e struttura dati ha il suo README separato e la relative spiegazioni e i link per ulteriori approfondimenti (compresi quelli su YouTube).
_Leggilo in altre lingue:_
[_简体中文_](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),
[_Türk_](README.tr-TR.md),
[_Bahasa Indonesia_](README.id-ID.md),
[_Українська_](README.uk-UA.md),
[_Arabic_](README.ar-AR.md),
[_Tiếng Việt_](README.vi-VN.md),
[_Deutsch_](README.de-DE.md),
[_Uzbek_](README.uz-UZ.md)
[_עברית_](README.he-IL.md)
## Strutture Dati
Una struttura dati è un particolare modo di organizzare e memorizzare i dati in un computer che permeta di accedervi e modificarli in modo efficiente. Più precisamente, una struttura dati è una raccolta di dati, le relazioni tra di essi e le funzioni o operazioni che possono essere applicate ai dati.
`P` - Principiante, `A` - Avanzato
* `P` [Lista Concatenata](src/data-structures/linked-list)
* `P` [Doppia Lista Concatenata](src/data-structures/doubly-linked-list)
* `P` [Coda](src/data-structures/queue)
* `P` [Pila](src/data-structures/stack)
* `P` [Hash Table](src/data-structures/hash-table)
* `P` [Heap](src/data-structures/heap) - versione massimo e minimo heap
* `P` [Coda di priorità](src/data-structures/priority-queue)
* `A` [Trie](src/data-structures/trie)
* `A` [Albero](src/data-structures/tree)
* `A` [Albero binario di ricerca](src/data-structures/tree/binary-search-tree)
* `A` [Albero AVL](src/data-structures/tree/avl-tree)
* `A` [RB Albero](src/data-structures/tree/red-black-tree)
* `A` [Albero Segmentato](src/data-structures/tree/segment-tree) - con min/max/sum esempi di query
* `A` [Albero di Fenwick](src/data-structures/tree/fenwick-tree) (Albero binario indicizzato)
* `A` [Grafo](src/data-structures/graph) (direzionale e unidirezionale)
* `A` [Set Disgiunto](src/data-structures/disjoint-set)
* `A` [Filtro Bloom](src/data-structures/bloom-filter)
## Algoritmi
Un algoritmo è una specifica univoca per risolvere una classe di problemi. È
un insieme di regole che definiscono con precisione una sequenza di operazioni.
`P` - Principiante, `A` - Avanzato
### Algoritmi per Topic
* **Matematica**
* `P` [Manipolazione dei Bit](src/algorithms/math/bits) - set/get/update/clear bits, moltiplicazione/divisione per due, gestire numeri negativi etc.
* `P` [Fattoriale](src/algorithms/math/factorial)
* `P` [Numeri di Fibonacci](src/algorithms/math/fibonacci) - classico e forma chiusa
* `P` [Test di Primalità](src/algorithms/math/primality-test) (metodo del divisore)
* `P` [Algoritmo di Euclide](src/algorithms/math/euclidean-algorithm) - trova il massimo comune divisore (MCD)
* `P` [Minimo Comune Multiplo](src/algorithms/math/least-common-multiple) (MCM)
* `P` [Crivello di Eratostene](src/algorithms/math/sieve-of-eratosthenes) - trova i numeri i primi fino al limite indicato
* `P` [Potenza di due](src/algorithms/math/is-power-of-two) - controlla se il numero è una potenza di due
* `P` [Triangolo di Pascal](src/algorithms/math/pascal-triangle)
* `P` [Numeri Complessi](src/algorithms/math/complex-number) - numeri complessi e operazioni
* `P` [Radiante & Gradi](src/algorithms/math/radian) - conversione da radiante a gradi e viceversa
* `P` [Potenza di un Numero](src/algorithms/math/fast-powering)
* `A` [Partizione di un Intero](src/algorithms/math/integer-partition)
* `A` [Radice Quadrata](src/algorithms/math/square-root) - Metodo di Newton
* `A` [Algoritmo di Liu Hui π](src/algorithms/math/liu-hui) - calcolare π usando un poligono
* `A` [Trasformata Discreta di Fourier ](src/algorithms/math/fourier-transform) -decomporre una funzione di tempo (un segnale) nelle frequenze che lo compongono
* **Set**
* `P` [Prodotto Cartesiano](src/algorithms/sets/cartesian-product) - moltiplicazione multipla di set
* `P` [Fisher–Yates Shuffle](src/algorithms/sets/fisher-yates) - permutazione casuale di un sequenza finita
* `A` [Power Set](src/algorithms/sets/power-set) - tutti i sottoinsiemi di un set (soluzioni bitwise e backtracking)
* `A` [Permutazioni](src/algorithms/sets/permutations) (con e senza ripetizioni)
* `A` [Combinazioni](src/algorithms/sets/combinations) (con e senza ripetizioni)
* `A` [Massima Sottosequenza Comune](src/algorithms/sets/longest-common-subsequence) (LCS)
* `A` [Massima Sottosequenza Crescente](src/algorithms/sets/longest-increasing-subsequence)
* `A` [Minima Sottosequenza Diffusa](src/algorithms/sets/shortest-common-supersequence) (SCS)
* `A` [Problema dello Zaino di Knapsack](src/algorithms/sets/knapsack-problem) - "0/1" e "Senza Restrizioni"
* `A` [Massimo SubArray](src/algorithms/sets/maximum-subarray) - "Brute Force" e "Programmazione Dinamica" versione Kadane
* `A` [Somma di Combinazioni](src/algorithms/sets/combination-sum) - ricerca di tutte le combinazioni di una somma
* **String**
* `P` [Distanza di Hamming](src/algorithms/string/hamming-distance) - numero di posizioni in cui i caratteri sono diversi
* `A` [Distanza di Levenshtein](src/algorithms/string/levenshtein-distance) - numero minimo di modifiche per rendere uguali due stringhe
* `A` [Algoritmo di Knuth-Morris-Pratt](src/algorithms/string/knuth-morris-pratt) (KMP) - ricerca nella sottostringa (pattern matching)
* `A` [Algoritmo Z](src/algorithms/string/z-algorithm) - ricerca nella sottostringa (pattern matching)
* `A` [Algoritmo di Rabin Karp ](src/algorithms/string/rabin-karp) - ricerca nella sottostringa
* `A` [Sottostringa Comune più lunga](src/algorithms/string/longest-common-substring)
* `A` [Espressioni Regolari](src/algorithms/string/regular-expression-matching)
* **Searches**
* `P` [Ricerca Sequenziale](src/algorithms/search/linear-search)
* `P` [Ricerca a Salti](src/algorithms/search/jump-search) (o Ricerca a Blocchi) - per la ricerca in array ordinati
* `P` [Ricerca Binari](src/algorithms/search/binary-search) - per la ricerca in array ordinati
* `P` [Ricerca Interpolata](src/algorithms/search/interpolation-search) - per la ricerca in un array ordinato uniformemente distibuito
* **Sorting**
* `P` [Bubble Sort](src/algorithms/sorting/bubble-sort)
* `P` [Selection Sort](src/algorithms/sorting/selection-sort)
* `P` [Insertion Sort](src/algorithms/sorting/insertion-sort)
* `P` [Heap Sort](src/algorithms/sorting/heap-sort)
* `P` [Merge Sort](src/algorithms/sorting/merge-sort)
* `P` [Quicksort](src/algorithms/sorting/quick-sort) - con e senza allocazione di ulteriore memoria
* `P` [Shellsort](src/algorithms/sorting/shell-sort)
* `P` [Counting Sort](src/algorithms/sorting/counting-sort)
* `P` [Radix Sort](src/algorithms/sorting/radix-sort)
* **Lista Concatenatas**
* `P` [Attraversamento Lista Concatenata](src/algorithms/linked-list/traversal)
* `P` [Attraversamento Lista Concatenata nel senso Contrario](src/algorithms/linked-list/reverse-traversal)
* **Alberi**
* `P` [Ricerca in Profondità su Alberi](src/algorithms/tree/depth-first-search) (DFS)
* `P` [Ricerca in Ampiezza su Alberi](src/algorithms/tree/breadth-first-search) (BFS)
* **Grafi**
* `P` [Ricerca in Profondità su Grafi](src/algorithms/graph/depth-first-search) (DFS)
* `P` [Breadth-First Search su Grafi](src/algorithms/graph/breadth-first-search) (BFS)
* `P` [Algoritmo di Kruskal](src/algorithms/graph/kruskal) - ricerca dell'Albero con Minima Distanza (MST) per grafi pesati unidirezionali
* `A` [Algoritmo di Dijkstra](src/algorithms/graph/dijkstra) - ricerca dei percorsi più breve per raggiungere tutti i vertici del grafo da un singolo vertice
* `A` [Algoritmo di Bellman-Ford](src/algorithms/graph/bellman-ford) - ricerca dei percorsi più breve per raggiungere tutti i vertici del grafo da un singolo vertice
* `A` [Algoritmo di Floyd-Warshall](src/algorithms/graph/floyd-warshall) - ricerca dei percorsi più brevi tra tutte le coppie di vertici
* `A` [Rivelamento dei Cicli](src/algorithms/graph/detect-cycle) - per grafici diretti e non diretti (basate su partizioni DFS e Disjoint Set)
* `A` [Algoritmo di Prim](src/algorithms/graph/prim) - ricerca dell'Albero Ricoprente Minimo (MST) per grafi unidirezionali pesati
* `A` [Ordinamento Topologico](src/algorithms/graph/topological-sorting) - metodo DFS
* `A` [Punti di Articolazione](src/algorithms/graph/articulation-points) - Algoritmo di Tarjan (basato su DFS)
* `A` [Bridges](src/algorithms/graph/bridges) - basato su DFS
* `A` [Cammino Euleriano e Circuito Euleriano](src/algorithms/graph/eulerian-path) - Algoritmo di Fleury - Visita ogni margine esattamente una volta
* `A` [Ciclo di Hamiltonian](src/algorithms/graph/hamiltonian-cycle) - Visita ad ogni vertice solo una volta
* `A` [Componenti Fortemente Connessa](src/algorithms/graph/strongly-connected-components) - algoritmo di Kosaraju
* `A` [Problema del Commesso Viaggiatore](src/algorithms/graph/travelling-salesman) - il percorso più breve che visita ogni città e ritorna alla città iniziale
* **Crittografia**
* `P` [Hash Polinomiale](src/algorithms/cryptography/polynomial-hash) - Una funzione hash di rolling basata sul polinomio
* **Senza categoria**
* `P` [Torre di Hanoi](src/algorithms/uncategorized/hanoi-tower)
* `P` [Rotazione Matrice Quadrata](src/algorithms/uncategorized/square-matrix-rotation) - algoritmo in memoria
* `P` [Jump Game](src/algorithms/uncategorized/jump-game) - backtracking, programmazione dinamica (top-down + bottom-up) ed esempre di greeedy
* `P` [Percorsi Unici](src/algorithms/uncategorized/unique-paths) - backtracking, programmazione dinamica and l'esempio del Triangolo di Pascal
* `P` [Rain Terraces](src/algorithms/uncategorized/rain-terraces) - problema dell'acqua piovana in trappola(versione con programmazione dinamica e brute force)
* `P` [Recursive Staircase](src/algorithms/uncategorized/recursive-staircase) - contare il numero di percorsi per arrivare in vetta(4 soluzioni)
* `A` [Rompicapo delle Otto Regine](src/algorithms/uncategorized/n-queens)
* `A` [Percorso del Cavallo](src/algorithms/uncategorized/knight-tour)
### Modelli di Algoritmi
Un modello di algoritmo è un generico metodo o approcio che sta alla base della progettazione di una classe di algoritmi.
Si tratta di un'astrazione ancora più alta di un algoritmo, proprio come un algoritmo è un'astrazione di un programma del computer.
* **Brute Force** - controlla tutte le possibilità e seleziona la migliore
* `P` [Ricerca Lineare](src/algorithms/search/linear-search)
* `P` [Rain Terraces](src/algorithms/uncategorized/rain-terraces) - problema dell'acqua piovana in trappola
* `P` [Recursive Staircase](src/algorithms/uncategorized/recursive-staircase) - contare il numero di percorsi per arrivare in vetta
* `A` [Massimo SubArray](src/algorithms/sets/maximum-subarray)
* `A` [Problema del commesso viaggiatore](src/algorithms/graph/travelling-salesman) - il percorso più breve che visita ogni città e ritorna alla città iniziale
* `A` [Trasformata Discreta di Fourier](src/algorithms/math/fourier-transform) - scomporre la funzione (segnale) del tempo in frequenze che la compongono
* **Greedy** - scegliere l'opzione migliore al momento d'eleborazione dell'algoritmo, senza alcuna considerazione per il futuro
* `P` [Jump Game](src/algorithms/uncategorized/jump-game)
* `A` [Problema dello Zaino di Knapsack](src/algorithms/sets/knapsack-problem)
* `A` [Algoritmo di Dijkstra](src/algorithms/graph/dijkstra) - ricerca del percorso più breve tra tutti i vertici del grafo
* `A` [Algoritmo di Prim](src/algorithms/graph/prim) - ricerca del Minimo Albero Ricoprente per grafi pesati e unidirezionali
* `A` [Kruskal’s Algorithm](src/algorithms/graph/kruskal) - finding Minimum Spanning Tree (MST) for weighted undirected graph
* **Divide e Conquista** - divide il problema in piccole parti e risolve ogni parte
* `P` [Ricerca Binaria](src/algorithms/search/binary-search)
* `P` [Torre di Hanoi](src/algorithms/uncategorized/hanoi-tower)
* `P` [Triangolo di Pascal](src/algorithms/math/pascal-triangle)
* `P` [Algoritmo di Euclide](src/algorithms/math/euclidean-algorithm) - calculate the Greatest Common Divisor (GCD)
* `P` [Merge Sort](src/algorithms/sorting/merge-sort)
* `P` [Quicksort](src/algorithms/sorting/quick-sort)
* `P` [Albero per Ricerca in Profondità](src/algorithms/tree/depth-first-search) (DFS)
* `P` [Grafo per Ricerca in Profondità](src/algorithms/graph/depth-first-search) (DFS)
* `P` [Jump Game](src/algorithms/uncategorized/jump-game)
* `P` [Algoritmo di Elevamento a Potenza](src/algorithms/math/fast-powering)
* `A` [Permutazioni](src/algorithms/sets/permutations) (con o senza ripetizioni)
* `A` [Combinazioni](src/algorithms/sets/combinations) (con o senza ripetizioni)
* **Programmazione Dinamica** - creare una soluzione utilizzando le sub-solution trovate in precedenza
* `P` [Numero di Fibonacci](src/algorithms/math/fibonacci)
* `P` [Jump Game](src/algorithms/uncategorized/jump-game)
* `P` [Percorsi Unici](src/algorithms/uncategorized/unique-paths)
* `P` [Rain Terraces](src/algorithms/uncategorized/rain-terraces) - problema dell'acqua piovana in trappola
* `P` [Recursive Staircase](src/algorithms/uncategorized/recursive-staircase) - contare il numero di percorsi per arrivare in vetta
* `A` [Distanza di Levenshtein](src/algorithms/string/levenshtein-distance) - minima variazione tra due sequenze
* `A` [La Più Lunga Frequente SottoSequenza](src/algorithms/sets/longest-common-subsequence) (LCS)
* `A` [La Più Lunga Frequente SubString](src/algorithms/string/longest-common-substring)
* `A` [La Più Lunga SottoSequenza Crescente](src/algorithms/sets/longest-increasing-subsequence)
* `A` [La Più Corta e Frequente SuperSequenza](src/algorithms/sets/shortest-common-supersequence)
* `A` [Problema dello zaino](src/algorithms/sets/knapsack-problem)
* `A` [Partizione di un Intero](src/algorithms/math/integer-partition)
* `A` [Massimo SubArray](src/algorithms/sets/maximum-subarray)
* `A` [Algoritmo di Bellman-Ford](src/algorithms/graph/bellman-ford) - ricerca del percorso più breve per tutti i vertici del grafo
* `A` [Algoritmo di Floyd-Warshall](src/algorithms/graph/floyd-warshall) - ricerca del percorso più breve tra tutte le coppie di vertici
* `A` [Espressioni Regolari](src/algorithms/string/regular-expression-matching)
* **Backtracking** - come la brute force, provate a generare tutte le soluzioni possibili, ma ogni volta che generate la prossima soluzione testate se soddisfa tutte le condizioni e solo allora continuare a generare soluzioni successive. Altrimenti, fate marcia indietro, e andate su un percorso diverso per trovare una soluzione. Normalmente si utilizza l'algoritmo DFS.
* `P` [Jump Game](src/algorithms/uncategorized/jump-game)
* `P` [Percorsi Unici](src/algorithms/uncategorized/unique-paths)
* `P` [Power Set](src/algorithms/sets/power-set) - tutti i subset di un set
* `A` [Ciclo di Hamiltonian](src/algorithms/graph/hamiltonian-cycle) - visita di tutti i vertici solamente una volta
* `A` [Problema di N-Queens](src/algorithms/uncategorized/n-queens)
* `A` [Knight's Tour](src/algorithms/uncategorized/knight-tour)
* `A` [Combinazioni di una Somma](src/algorithms/sets/combination-sum) - trovare tutte le combinazioni che compongono una somma
* **Branch & Bound** - ricordatevi che la soluzione meno costosa trovata ad ogni step durante il backtracking e
il costo di usare la soluzione meno costosa trovata fino al limite inferiore al costo minimo della soluzione al problema,
al fine di scartare soluzioni parziali con costi maggiori della soluzione meno costosa trovata .
Di solito si usa BFS trasversale in combinazione con DFS trasversale .
## Come usare questa repository
**Installare tutte le dipendenze**
```
npm install
```
**Eseguire ESLint**
Potresti usarlo per controllare la qualità del codice.
```
npm run lint
```
**Eseguire tutti i test**
```
npm test
```
**Eseguire un test tramite il nome**
```
npm test -- 'LinkedList'
```
**Playground**
Se vuoi puoi giocare le strutture dati e gli algoritmi nel file ./src/playground/playground.js` e
scrivere test nel file `./src/playground/__test__/playground.test.js`.
Poi puoi semplicemente eseguire il seguente comando per testare quello che hai scritto :
```
npm test -- 'playground'
```
## Informazioni Utili
### Bibliografia
[▶ Data Structures and Algorithms on YouTube](https://www.youtube.com/playlist?list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8)
### Notazione Big O
* La notazione Big O* è usata per classificare algoritmi in base al tempo di esecuzione o ai
requisiti di spazio che crescono in base alla crescita dell'input .
Nella grafico qua sotto puoi trovare gli ordini di crescita più comuni degli algoritmi usando la notazione Big O.

Riferimento: [Big O Cheat Sheet](http://bigocheatsheet.com/).
Nella tabella qua sotto ci sono riportate la lista delle notazioni Big O più usate e delle loro prestazioni comparate tra differenti grandezze d'input .
| Notazione Big O | Computazione con 10 elementi | Computazione con 100 elementi | Computazione con 1000 elementi |
| --------------- | ---------------------------- | ----------------------------- | ------------------------------- |
| **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 |
### Complessità delle Operazion sulle Strutture Dati
| Struttura Dati | Accesso | Ricerca | Inserimento | Rimozione | Commenti |
| ----------------------- | :-------: | :-------: | :--------: | :-------: | :-------- |
| **Array** | 1 | n | n | n | |
| **Pila** | n | n | 1 | 1 | |
| **Coda** | n | n | 1 | 1 | |
| **Lista Concatenata** | n | n | 1 | n | |
| **Tabella Hash** | - | n | n | n | Nel caso di una funzione di hashing perfetta il costo sarebbe O(1)|
| **Binary Search Tree** | n | n | n | n | Nel caso di albero bilanciato il costo sarebbe O(log(n)) |
| **B-Tree** | log(n) | log(n) | log(n) | log(n) | |
| **Red-Black Tree** | log(n) | log(n) | log(n) | log(n) | |
| **Albero AVL** | log(n) | log(n) | log(n) | log(n) | |
| **Bloom Filter** | - | 1 | 1 | - | Falsi positivi sono possibili durante la ricerca |
### Complessità degli Algoritmi di Ordinamento di Array
| Nome | Milgiore | Media | Perggiore | Memoria | Stabile | Commenti |
| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- |
| **Bubble sort** | n | n<sup>2</sup> | n<sup>2</sup> | 1 | Yes | |
| **Insertion sort** | n | n<sup>2</sup> | n<sup>2</sup> | 1 | Yes | |
| **Selection sort** | n<sup>2</sup> | n<sup>2</sup> | n<sup>2</sup> | 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) | n<sup>2</sup> | log(n) | No | Quicksort viene eseguito in memoria solitamente con una pila di O(log(n)) |
| **Shell sort** | n log(n) | dipende dagli spazi vuoti nella sequenza | n (log(n))<sup>2</sup> | 1 | No | |
| **Counting sort** | n + r | n + r | n + r | n + r | Yes | r - numero più grande nell'array |
| **Radix sort** | n * k | n * k | n * k | n + k | Yes | k - lunghezza della chiave più grande |
> ℹ️ A few more [projects](https://trekhleb.dev/projects/) and [articles](https://trekhleb.dev/blog/) about JavaScript and algorithms on [trekhleb.dev](https://trekhleb.dev)
================================================
FILE: README.ja-JP.md
================================================
# JavaScriptアルゴリズムとデータ構造
[](https://github.com/trekhleb/javascript-algorithms/actions?query=workflow%3ACI+branch%3Amaster)
[](https://codecov.io/gh/trekhleb/javascript-algorithms)
このリポジトリには、JavaScriptベースの一般的なアルゴリズムとデータ構造に関する多数のサンプルが含まれています。
各アルゴリズムとデータ構造には独自のREADMEがあります。
関連する説明、そして参考資料 (YouTube動画)も含まれています。
_Read this in other languages:_
[_English_](https://github.com/trekhleb/javascript-algorithms/),
[_简体中文_](README.zh-CN.md),
[_繁體中文_](README.zh-TW.md),
[_한국어_](README.ko-KR.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),
[_Türk_](README.tr-TR.md),
[_Italiana_](README.it-IT.md),
[_Bahasa Indonesia_](README.id-ID.md),
[_Українська_](README.uk-UA.md),
[_Arabic_](README.ar-AR.md),
[_Tiếng Việt_](README.vi-VN.md),
[_Deutsch_](README.de-DE.md),
[_Uzbek_](README.uz-UZ.md)
[_עברית_](README.he-IL.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) - 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` - 初心者, `A` - 上級
### トピック別アルゴリズム
* **数学**
* `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) (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) -インプレースおよび非インプレース・インプリメンテーション
* `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)
* **バックトラッキング** - ブルートフォースと同様に、可能なすべてのソリューションを生成しようとしますが、
次のソリューションを生成するたびにすべての条件を満たすかどうかをテストし、それ以降は引き続きソリューションを生成します。
それ以外の場合は、バックトラックして、解決策を見つける別の経路に進みます。
通常、状態空間の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を実行する**
これを実行してコードの品質をチェックすることができます。
```
npm run lint
```
**すべてのテストを実行する**
```
npm test
```
**名前でテストを実行する**
```
npm test -- 'LinkedList'
```
**playground**
データ構造とアルゴリズムを `./src/playground/playground.js` ファイルで再生し、
それに対するテストを書くことができ `./src/playground/__test__/playground.test.js`.
次に、次のコマンドを実行して、遊び場コードが正常に動作するかどうかをテストします。
```
npm test -- 'playground'
```
## 有用な情報
### 参考文献
[▶ データ構造とアルゴリズム on YouTube](https://www.youtube.com/playlist?list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8)
### ビッグO表記
*Big O表記法は* 入力サイズが大きくなるにつれて実行時間やスペース要件がどのように増加するかに応じてアルゴリズムを分類するために使用されます。下のチャートでは、Big O表記で指定されたアルゴリズムの成長の最も一般的な順序を見つけることができます。

出典: [Big Oチートシート](http://bigocheatsheet.com/).
以下は、最も使用されている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 |
### データ構造操作の複雑さ
| 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 | n<sup>2</sup> | n<sup>2</sup> | 1 | Yes | |
| **Insertion sort** | n | n<sup>2</sup> | n<sup>2</sup> | 1 | Yes | |
| **Selection sort** | n<sup>2</sup> | n<sup>2</sup> | n<sup>2</sup> | 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) | n<sup>2</sup> | 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))<sup>2</sup> | 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 |
> ℹ️ A few more [projects](https://trekhleb.dev/projects/) and [articles](https://trekhleb.dev/blog/) about JavaScript and algorithms on [trekhleb.dev](https://trekhleb.dev)
================================================
FILE: README.ko-KR.md
================================================
# JavaScript 알고리즘 및 자료 구조
[](https://github.com/trekhleb/javascript-algorithms/actions?query=workflow%3ACI+branch%3Amaster)
[](https://codecov.io/gh/trekhleb/javascript-algorithms)
이 저장소에는 많이 알려진 알고리즘 및 자료 구조의 Javascript 기반 예제를 담고 있습니다.
각 알고리즘과 자료 구조에 대해 연관되어 있는 설명이 README에 작성되어 있으며,
링크를 통해 더 자세한 설명을 만날 수 있습니다. (관련된 YouTube 영상도 포함).
_Read this in other languages:_
[_English_](https://github.com/trekhleb/javascript-algorithms/),
[_简体中文_](README.zh-CN.md),
[_繁體中文_](README.zh-TW.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),
[_Türk_](README.tr-TR.md),
[_Italiana_](README.it-IT.md),
[_Bahasa Indonesia_](README.id-ID.md),
[_Українська_](README.uk-UA.md),
[_Arabic_](README.ar-AR.md),
[_Tiếng Việt_](README.vi-VN.md),
[_Deutsch_](README.de-DE.md),
[_Uzbek_](README.uz-UZ.md)
[_עברית_](README.he-IL.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` - 입문자, `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)
### 패러다임별 알고리즘
알고리즘 패러다임 이란, 알고리즘이 주어진 문제를 해결하기 위해 채택한 기초가 되는 일반적인 방법 혹은 접근법입니다. 알고리즘이 해결하는 문제나 알고리즘의 동작 방식이 완전히 다르더라도,알고리즘의 동작 원칙이 같으면 같은 패러다음을 사용했다고 말할 수 있으며, 주로 알고리즘을 구분하는 기준으로 쓰인다. 알고리즘이 일반적인 컴퓨터의 프로그램에 대한 개념보다 보다 더 추상적인 개념인 것처럼 알고리즘의 패러다임은 명확히 정의된 수학적 실체가 있는 것이 아니기 때문에 그 어떤 알고리즘의 개념보다도 훨씬 추상적인 개념입니다.
* **브루트 포스(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
```
**ESLint 실행**
코드의 품질을 확인 할 수 있습니다.
```
npm run lint
```
**모든 테스트 실행**
```
npm test
```
**이름을 통해 특정 테스트 실행**
```
npm test -- 'LinkedList'
```
**Play
gitextract_7srfgao2/
├── .babelrc
├── .editorconfig
├── .eslintrc
├── .github/
│ └── workflows/
│ └── CI.yml
├── .gitignore
├── .husky/
│ └── pre-commit
├── .npmrc
├── .nvmrc
├── BACKERS.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.ar-AR.md
├── README.de-DE.md
├── README.es-ES.md
├── README.fr-FR.md
├── README.he-IL.md
├── README.id-ID.md
├── README.it-IT.md
├── README.ja-JP.md
├── README.ko-KR.md
├── README.md
├── README.pl-PL.md
├── README.pt-BR.md
├── README.ru-RU.md
├── README.tr-TR.md
├── README.uk-UA.md
├── README.uz-UZ.md
├── README.vi-VN.md
├── README.zh-CN.md
├── README.zh-TW.md
├── jest.config.js
├── package.json
└── src/
├── algorithms/
│ ├── cryptography/
│ │ ├── caesar-cipher/
│ │ │ ├── README.md
│ │ │ ├── README.ru-RU.md
│ │ │ ├── __test__/
│ │ │ │ └── caesarCipher.test.js
│ │ │ └── caesarCipher.js
│ │ ├── hill-cipher/
│ │ │ ├── README.md
│ │ │ ├── _test_/
│ │ │ │ └── hillCipher.test.js
│ │ │ └── hillCipher.js
│ │ ├── polynomial-hash/
│ │ │ ├── PolynomialHash.js
│ │ │ ├── README.md
│ │ │ ├── SimplePolynomialHash.js
│ │ │ └── __test__/
│ │ │ ├── PolynomialHash.test.js
│ │ │ └── SimplePolynomialHash.test.js
│ │ └── rail-fence-cipher/
│ │ ├── README.md
│ │ ├── __test__/
│ │ │ └── railFenceCipher.test.js
│ │ └── railFenceCipher.js
│ ├── graph/
│ │ ├── articulation-points/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── articulationPoints.test.js
│ │ │ └── articulationPoints.js
│ │ ├── bellman-ford/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── bellmanFord.test.js
│ │ │ └── bellmanFord.js
│ │ ├── breadth-first-search/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── breadthFirstSearch.test.js
│ │ │ └── breadthFirstSearch.js
│ │ ├── bridges/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── graphBridges.test.js
│ │ │ └── graphBridges.js
│ │ ├── depth-first-search/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── depthFirstSearch.test.js
│ │ │ └── depthFirstSearch.js
│ │ ├── detect-cycle/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ ├── detectDirectedCycle.test.js
│ │ │ │ ├── detectUndirectedCycle.test.js
│ │ │ │ └── detectUndirectedCycleUsingDisjointSet.test.js
│ │ │ ├── detectDirectedCycle.js
│ │ │ ├── detectUndirectedCycle.js
│ │ │ └── detectUndirectedCycleUsingDisjointSet.js
│ │ ├── dijkstra/
│ │ │ ├── README.de-DE.md
│ │ │ ├── README.es-ES.md
│ │ │ ├── README.fr-FR.md
│ │ │ ├── README.he-IL.md
│ │ │ ├── README.ja-JP.md
│ │ │ ├── README.ko-KR.md
│ │ │ ├── README.md
│ │ │ ├── README.uk-UA.md
│ │ │ ├── README.zh-CN.md
│ │ │ ├── README.zh-TW.md
│ │ │ ├── __test__/
│ │ │ │ └── dijkstra.test.js
│ │ │ └── dijkstra.js
│ │ ├── eulerian-path/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── eulerianPath.test.js
│ │ │ └── eulerianPath.js
│ │ ├── floyd-warshall/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── floydWarshall.test.js
│ │ │ └── floydWarshall.js
│ │ ├── hamiltonian-cycle/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── hamiltonianCycle.test.js
│ │ │ └── hamiltonianCycle.js
│ │ ├── kruskal/
│ │ │ ├── README.ko-KR.md
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── kruskal.test.js
│ │ │ └── kruskal.js
│ │ ├── prim/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── prim.test.js
│ │ │ └── prim.js
│ │ ├── strongly-connected-components/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── stronglyConnectedComponents.test.js
│ │ │ └── stronglyConnectedComponents.js
│ │ ├── topological-sorting/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── topologicalSort.test.js
│ │ │ └── topologicalSort.js
│ │ └── travelling-salesman/
│ │ ├── README.md
│ │ ├── __test__/
│ │ │ └── bfTravellingSalesman.test.js
│ │ └── bfTravellingSalesman.js
│ ├── image-processing/
│ │ ├── seam-carving/
│ │ │ ├── README.md
│ │ │ ├── README.ru-RU.md
│ │ │ ├── __tests__/
│ │ │ │ └── resizeImageWidth.node.js
│ │ │ └── resizeImageWidth.js
│ │ └── utils/
│ │ └── imageData.js
│ ├── linked-list/
│ │ ├── reverse-traversal/
│ │ │ ├── README.md
│ │ │ ├── README.pt-BR.md
│ │ │ ├── README.zh-CN.md
│ │ │ ├── __test__/
│ │ │ │ └── reverseTraversal.test.js
│ │ │ └── reverseTraversal.js
│ │ └── traversal/
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── README.ru-RU.md
│ │ ├── README.zh-CN.md
│ │ ├── __test__/
│ │ │ └── traversal.test.js
│ │ └── traversal.js
│ ├── math/
│ │ ├── binary-floating-point/
│ │ │ ├── README.md
│ │ │ ├── __tests__/
│ │ │ │ ├── bitsToFloat.test.js
│ │ │ │ └── floatAsBinaryString.test.js
│ │ │ ├── bitsToFloat.js
│ │ │ ├── floatAsBinaryString.js
│ │ │ └── testCases.js
│ │ ├── bits/
│ │ │ ├── README.fr-FR.md
│ │ │ ├── README.md
│ │ │ ├── README.zh-CN.md
│ │ │ ├── __test__/
│ │ │ │ ├── bitLength.test.js
│ │ │ │ ├── bitsDiff.test.js
│ │ │ │ ├── clearBit.test.js
│ │ │ │ ├── countSetBits.test.js
│ │ │ │ ├── divideByTwo.test.js
│ │ │ │ ├── fullAdder.test.js
│ │ │ │ ├── getBit.test.js
│ │ │ │ ├── isEven.test.js
│ │ │ │ ├── isPositive.test.js
│ │ │ │ ├── isPowerOfTwo.test.js
│ │ │ │ ├── multiply.test.js
│ │ │ │ ├── multiplyByTwo.test.js
│ │ │ │ ├── multiplyUnsigned.test.js
│ │ │ │ ├── setBit.test.js
│ │ │ │ ├── switchSign.test.js
│ │ │ │ └── updateBit.test.js
│ │ │ ├── bitLength.js
│ │ │ ├── bitsDiff.js
│ │ │ ├── clearBit.js
│ │ │ ├── countSetBits.js
│ │ │ ├── divideByTwo.js
│ │ │ ├── fullAdder.js
│ │ │ ├── getBit.js
│ │ │ ├── isEven.js
│ │ │ ├── isPositive.js
│ │ │ ├── isPowerOfTwo.js
│ │ │ ├── multiply.js
│ │ │ ├── multiplyByTwo.js
│ │ │ ├── multiplyUnsigned.js
│ │ │ ├── setBit.js
│ │ │ ├── switchSign.js
│ │ │ └── updateBit.js
│ │ ├── complex-number/
│ │ │ ├── ComplexNumber.js
│ │ │ ├── README.fr-FR.md
│ │ │ ├── README.md
│ │ │ └── __test__/
│ │ │ └── ComplexNumber.test.js
│ │ ├── euclidean-algorithm/
│ │ │ ├── README.fr-FR.md
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ ├── euclideanAlgorithm.test.js
│ │ │ │ └── euclideanAlgorithmIterative.test.js
│ │ │ ├── euclideanAlgorithm.js
│ │ │ └── euclideanAlgorithmIterative.js
│ │ ├── euclidean-distance/
│ │ │ ├── README.md
│ │ │ ├── __tests__/
│ │ │ │ └── euclideanDistance.test.js
│ │ │ └── euclideanDistance.js
│ │ ├── factorial/
│ │ │ ├── README.fr-FR.md
│ │ │ ├── README.ka-GE.md
│ │ │ ├── README.md
│ │ │ ├── README.tr-TR.md
│ │ │ ├── README.uk-UA.md
│ │ │ ├── README.zh-CN.md
│ │ │ ├── __test__/
│ │ │ │ ├── factorial.test.js
│ │ │ │ └── factorialRecursive.test.js
│ │ │ ├── factorial.js
│ │ │ └── factorialRecursive.js
│ │ ├── fast-powering/
│ │ │ ├── README.fr-FR.md
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── fastPowering.test.js
│ │ │ └── fastPowering.js
│ │ ├── fibonacci/
│ │ │ ├── README.fr-FR.md
│ │ │ ├── README.ka-GE.md
│ │ │ ├── README.md
│ │ │ ├── README.zh-CN.md
│ │ │ ├── __test__/
│ │ │ │ ├── fibonacci.test.js
│ │ │ │ ├── fibonacciNth.test.js
│ │ │ │ └── fibonacciNthClosedForm.test.js
│ │ │ ├── fibonacci.js
│ │ │ ├── fibonacciNth.js
│ │ │ └── fibonacciNthClosedForm.js
│ │ ├── fourier-transform/
│ │ │ ├── README.fr-FR.md
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ ├── FourierTester.js
│ │ │ │ ├── discreteFourierTransform.test.js
│ │ │ │ ├── fastFourierTransform.test.js
│ │ │ │ └── inverseDiscreteFourierTransform.test.js
│ │ │ ├── discreteFourierTransform.js
│ │ │ ├── fastFourierTransform.js
│ │ │ └── inverseDiscreteFourierTransform.js
│ │ ├── horner-method/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ ├── classicPolynome.test.js
│ │ │ │ └── hornerMethod.test.js
│ │ │ ├── classicPolynome.js
│ │ │ └── hornerMethod.js
│ │ ├── integer-partition/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── integerPartition.test.js
│ │ │ └── integerPartition.js
│ │ ├── is-power-of-two/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ ├── isPowerOfTwo.test.js
│ │ │ │ └── isPowerOfTwoBitwise.test.js
│ │ │ ├── isPowerOfTwo.js
│ │ │ └── isPowerOfTwoBitwise.js
│ │ ├── least-common-multiple/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── leastCommonMultiple.test.js
│ │ │ └── leastCommonMultiple.js
│ │ ├── liu-hui/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── liuHui.test.js
│ │ │ └── liuHui.js
│ │ ├── matrix/
│ │ │ ├── Matrix.js
│ │ │ ├── README.md
│ │ │ └── __tests__/
│ │ │ └── Matrix.test.js
│ │ ├── pascal-triangle/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ ├── pascalTriangle.test.js
│ │ │ │ └── pascalTriangleRecursive.test.js
│ │ │ ├── pascalTriangle.js
│ │ │ └── pascalTriangleRecursive.js
│ │ ├── primality-test/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── trialDivision.test.js
│ │ │ └── trialDivision.js
│ │ ├── prime-factors/
│ │ │ ├── README.md
│ │ │ ├── README.zh-CN.md
│ │ │ ├── __test__/
│ │ │ │ └── primeFactors.test.js
│ │ │ └── primeFactors.js
│ │ ├── radian/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ ├── degreeToRadian.test.js
│ │ │ │ └── radianToDegree.test.js
│ │ │ ├── degreeToRadian.js
│ │ │ └── radianToDegree.js
│ │ ├── sieve-of-eratosthenes/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── sieveOfEratosthenes.test.js
│ │ │ └── sieveOfEratosthenes.js
│ │ └── square-root/
│ │ ├── README.md
│ │ ├── __test__/
│ │ │ └── squareRoot.test.js
│ │ └── squareRoot.js
│ ├── ml/
│ │ ├── k-means/
│ │ │ ├── README.md
│ │ │ ├── README.pt-BR.md
│ │ │ ├── __test__/
│ │ │ │ └── kMeans.test.js
│ │ │ └── kMeans.js
│ │ └── knn/
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── __test__/
│ │ │ └── knn.test.js
│ │ └── kNN.js
│ ├── search/
│ │ ├── binary-search/
│ │ │ ├── README.es-ES.md
│ │ │ ├── README.md
│ │ │ ├── README.pt-BR.md
│ │ │ ├── __test__/
│ │ │ │ └── binarySearch.test.js
│ │ │ └── binarySearch.js
│ │ ├── interpolation-search/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── interpolationSearch.test.js
│ │ │ └── interpolationSearch.js
│ │ ├── jump-search/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── jumpSearch.test.js
│ │ │ └── jumpSearch.js
│ │ └── linear-search/
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── __test__/
│ │ │ └── linearSearch.test.js
│ │ └── linearSearch.js
│ ├── sets/
│ │ ├── cartesian-product/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── cartesianProduct.test.js
│ │ │ └── cartesianProduct.js
│ │ ├── combination-sum/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── combinationSum.test.js
│ │ │ └── combinationSum.js
│ │ ├── combinations/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ ├── combineWithRepetitions.test.js
│ │ │ │ └── combineWithoutRepetitions.test.js
│ │ │ ├── combineWithRepetitions.js
│ │ │ └── combineWithoutRepetitions.js
│ │ ├── fisher-yates/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── fisherYates.test.js
│ │ │ └── fisherYates.js
│ │ ├── knapsack-problem/
│ │ │ ├── Knapsack.js
│ │ │ ├── KnapsackItem.js
│ │ │ ├── README.md
│ │ │ └── __test__/
│ │ │ ├── Knapsack.test.js
│ │ │ └── KnapsackItem.test.js
│ │ ├── longest-common-subsequence/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ ├── longestCommonSubsequence.test.js
│ │ │ │ └── longestCommonSubsequenceRecursive.test.js
│ │ │ ├── longestCommonSubsequence.js
│ │ │ └── longestCommonSubsequenceRecursive.js
│ │ ├── longest-increasing-subsequence/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── dpLongestIncreasingSubsequence.test.js
│ │ │ └── dpLongestIncreasingSubsequence.js
│ │ ├── maximum-subarray/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ ├── bfMaximumSubarray.test.js
│ │ │ │ ├── dcMaximumSubarraySum.test.js
│ │ │ │ └── dpMaximumSubarray.test.js
│ │ │ ├── bfMaximumSubarray.js
│ │ │ ├── dcMaximumSubarraySum.js
│ │ │ └── dpMaximumSubarray.js
│ │ ├── permutations/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ ├── permutateWithRepetitions.test.js
│ │ │ │ └── permutateWithoutRepetitions.test.js
│ │ │ ├── permutateWithRepetitions.js
│ │ │ └── permutateWithoutRepetitions.js
│ │ ├── power-set/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ ├── btPowerSet.test.js
│ │ │ │ ├── bwPowerSet.test.js
│ │ │ │ └── caPowerSet.test.js
│ │ │ ├── btPowerSet.js
│ │ │ ├── bwPowerSet.js
│ │ │ └── caPowerSet.js
│ │ └── shortest-common-supersequence/
│ │ ├── README.md
│ │ ├── __test__/
│ │ │ └── shortestCommonSupersequence.test.js
│ │ └── shortestCommonSupersequence.js
│ ├── sorting/
│ │ ├── Sort.js
│ │ ├── SortTester.js
│ │ ├── __test__/
│ │ │ └── Sort.test.js
│ │ ├── bubble-sort/
│ │ │ ├── BubbleSort.js
│ │ │ ├── README.md
│ │ │ ├── README.pt-BR.md
│ │ │ └── __test__/
│ │ │ └── BubbleSort.test.js
│ │ ├── bucket-sort/
│ │ │ ├── BucketSort.js
│ │ │ ├── README.md
│ │ │ └── __test__/
│ │ │ └── BucketSort.test.js
│ │ ├── counting-sort/
│ │ │ ├── CountingSort.js
│ │ │ ├── README.md
│ │ │ ├── README.pt-br.md
│ │ │ └── __test__/
│ │ │ └── CountingSort.test.js
│ │ ├── heap-sort/
│ │ │ ├── HeapSort.js
│ │ │ ├── README.md
│ │ │ ├── README.pt-BR.md
│ │ │ └── __test__/
│ │ │ └── HeapSort.test.js
│ │ ├── insertion-sort/
│ │ │ ├── InsertionSort.js
│ │ │ ├── README.md
│ │ │ ├── README.pt-BR.md
│ │ │ └── __test__/
│ │ │ └── InsertionSort.test.js
│ │ ├── merge-sort/
│ │ │ ├── MergeSort.js
│ │ │ ├── README.ko-KR.md
│ │ │ ├── README.md
│ │ │ ├── README.pt-BR.md
│ │ │ └── __test__/
│ │ │ └── MergeSort.test.js
│ │ ├── quick-sort/
│ │ │ ├── QuickSort.js
│ │ │ ├── QuickSortInPlace.js
│ │ │ ├── README.md
│ │ │ ├── README.pt-BR.md
│ │ │ ├── README.zh-CN.md
│ │ │ └── __test__/
│ │ │ ├── QuickSort.test.js
│ │ │ └── QuickSortInPlace.test.js
│ │ ├── radix-sort/
│ │ │ ├── README.md
│ │ │ ├── README.pt-BR.md
│ │ │ ├── RadixSort.js
│ │ │ └── __test__/
│ │ │ └── RadixSort.test.js
│ │ ├── selection-sort/
│ │ │ ├── README.md
│ │ │ ├── README.pt-BR.md
│ │ │ ├── SelectionSort.js
│ │ │ └── __test__/
│ │ │ └── SelectionSort.test.js
│ │ └── shell-sort/
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── ShellSort.js
│ │ └── __test__/
│ │ └── ShellSort.test.js
│ ├── stack/
│ │ └── valid-parentheses/
│ │ ├── README.md
│ │ ├── __test__/
│ │ │ └── validParentheses.test.js
│ │ └── validParentheses.js
│ ├── statistics/
│ │ └── weighted-random/
│ │ ├── README.md
│ │ ├── __test__/
│ │ │ └── weightedRandom.test.js
│ │ └── weightedRandom.js
│ ├── string/
│ │ ├── hamming-distance/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── hammingDistance.test.js
│ │ │ └── hammingDistance.js
│ │ ├── knuth-morris-pratt/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── knuthMorrisPratt.test.js
│ │ │ └── knuthMorrisPratt.js
│ │ ├── levenshtein-distance/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── levenshteinDistance.test.js
│ │ │ └── levenshteinDistance.js
│ │ ├── longest-common-substring/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── longestCommonSubstring.test.js
│ │ │ └── longestCommonSubstring.js
│ │ ├── palindrome/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── isPalindrome.test.js
│ │ │ └── isPalindrome.js
│ │ ├── rabin-karp/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── rabinKarp.test.js
│ │ │ └── rabinKarp.js
│ │ ├── regular-expression-matching/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── regularExpressionMatching.test.js
│ │ │ └── regularExpressionMatching.js
│ │ └── z-algorithm/
│ │ ├── README.md
│ │ ├── __test__/
│ │ │ └── zAlgorithm.test.js
│ │ └── zAlgorithm.js
│ ├── tree/
│ │ ├── breadth-first-search/
│ │ │ ├── README.md
│ │ │ ├── __test__/
│ │ │ │ └── breadthFirstSearch.test.js
│ │ │ └── breadthFirstSearch.js
│ │ └── depth-first-search/
│ │ ├── README.md
│ │ ├── __test__/
│ │ │ └── depthFirstSearch.test.js
│ │ └── depthFirstSearch.js
│ └── uncategorized/
│ ├── best-time-to-buy-sell-stocks/
│ │ ├── README.md
│ │ ├── __tests__/
│ │ │ ├── accumulatorBestTimeToBuySellStocks.test.js
│ │ │ ├── dpBestTimeToBuySellStocks.test.js
│ │ │ ├── dqBestTimeToBuySellStocks.test.js
│ │ │ └── peakvalleyBestTimeToBuySellStocks.test.js
│ │ ├── accumulatorBestTimeToBuySellStocks.js
│ │ ├── dpBestTimeToBuySellStocks.js
│ │ ├── dqBestTimeToBuySellStocks.js
│ │ └── peakvalleyBestTimeToBuySellStocks.js
│ ├── hanoi-tower/
│ │ ├── README.md
│ │ ├── __test__/
│ │ │ └── hanoiTower.test.js
│ │ └── hanoiTower.js
│ ├── jump-game/
│ │ ├── README.md
│ │ ├── __test__/
│ │ │ ├── backtrackingJumpGame.test.js
│ │ │ ├── dpBottomUpJumpGame.test.js
│ │ │ ├── dpTopDownJumpGame.test.js
│ │ │ └── greedyJumpGame.test.js
│ │ ├── backtrackingJumpGame.js
│ │ ├── dpBottomUpJumpGame.js
│ │ ├── dpTopDownJumpGame.js
│ │ └── greedyJumpGame.js
│ ├── knight-tour/
│ │ ├── README.md
│ │ ├── __test__/
│ │ │ └── knightTour.test.js
│ │ └── knightTour.js
│ ├── n-queens/
│ │ ├── QueenPosition.js
│ │ ├── README.md
│ │ ├── __test__/
│ │ │ ├── QueensPosition.test.js
│ │ │ ├── nQueens.test.js
│ │ │ └── nQueensBitwise.test.js
│ │ ├── nQueens.js
│ │ └── nQueensBitwise.js
│ ├── rain-terraces/
│ │ ├── README.md
│ │ ├── __test__/
│ │ │ ├── bfRainTerraces.test.js
│ │ │ └── dpRainTerraces.test.js
│ │ ├── bfRainTerraces.js
│ │ └── dpRainTerraces.js
│ ├── recursive-staircase/
│ │ ├── README.md
│ │ ├── __test__/
│ │ │ ├── recursiveStaircaseBF.test.js
│ │ │ ├── recursiveStaircaseDP.test.js
│ │ │ ├── recursiveStaircaseIT.test.js
│ │ │ └── recursiveStaircaseMEM.test.js
│ │ ├── recursiveStaircaseBF.js
│ │ ├── recursiveStaircaseDP.js
│ │ ├── recursiveStaircaseIT.js
│ │ └── recursiveStaircaseMEM.js
│ ├── square-matrix-rotation/
│ │ ├── README.md
│ │ ├── __test__/
│ │ │ └── squareMatrixRotation.test.js
│ │ └── squareMatrixRotation.js
│ └── unique-paths/
│ ├── README.md
│ ├── __test__/
│ │ ├── btUniquePaths.test.js
│ │ ├── dpUniquePaths.test.js
│ │ └── uniquePaths.test.js
│ ├── btUniquePaths.js
│ ├── dpUniquePaths.js
│ └── uniquePaths.js
├── data-structures/
│ ├── bloom-filter/
│ │ ├── BloomFilter.js
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── README.ru-RU.md
│ │ ├── README.uk-UA.md
│ │ └── __test__/
│ │ └── BloomFilter.test.js
│ ├── disjoint-set/
│ │ ├── DisjointSet.js
│ │ ├── DisjointSetAdhoc.js
│ │ ├── DisjointSetItem.js
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── README.ru-RU.md
│ │ ├── README.uk-UA.md
│ │ └── __test__/
│ │ ├── DisjointSet.test.js
│ │ ├── DisjointSetAdhoc.test.js
│ │ └── DisjointSetItem.test.js
│ ├── doubly-linked-list/
│ │ ├── DoublyLinkedList.js
│ │ ├── DoublyLinkedListNode.js
│ │ ├── README.es-ES.md
│ │ ├── README.ja-JP.md
│ │ ├── README.ko-KR.md
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── README.ru-RU.md
│ │ ├── README.uk-UA.md
│ │ ├── README.zh-CN.md
│ │ └── __test__/
│ │ ├── DoublyLinkedList.test.js
│ │ └── DoublyLinkedListNode.test.js
│ ├── graph/
│ │ ├── Graph.js
│ │ ├── GraphEdge.js
│ │ ├── GraphVertex.js
│ │ ├── README.fr-FR.md
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── README.ru-RU.md
│ │ ├── README.uk-UA.md
│ │ ├── README.zh-CN.md
│ │ └── __test__/
│ │ ├── Graph.test.js
│ │ ├── GraphEdge.test.js
│ │ └── GraphVertex.test.js
│ ├── hash-table/
│ │ ├── HashTable.js
│ │ ├── README.fr-FR.md
│ │ ├── README.ja-JP.md
│ │ ├── README.ko-KR.md
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── README.ru-RU.md
│ │ ├── README.uk-UA.md
│ │ ├── README.zh-CN.md
│ │ └── __test__/
│ │ └── HashTable.test.js
│ ├── heap/
│ │ ├── Heap.js
│ │ ├── MaxHeap.js
│ │ ├── MaxHeapAdhoc.js
│ │ ├── MinHeap.js
│ │ ├── MinHeapAdhoc.js
│ │ ├── README.fr-FR.md
│ │ ├── README.ja-JP.md
│ │ ├── README.ko-KR.md
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── README.ru-RU.md
│ │ ├── README.tr-TR.md
│ │ ├── README.uk-UA.md
│ │ ├── README.zh-CN.md
│ │ └── __test__/
│ │ ├── Heap.test.js
│ │ ├── MaxHeap.test.js
│ │ ├── MaxHeapAdhoc.test.js
│ │ ├── MinHeap.test.js
│ │ └── MinHeapAdhoc.test.js
│ ├── linked-list/
│ │ ├── LinkedList.js
│ │ ├── LinkedListNode.js
│ │ ├── README.es-ES.md
│ │ ├── README.ja-JP.md
│ │ ├── README.ko-KR.md
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── README.ru-RU.md
│ │ ├── README.tr-TR.md
│ │ ├── README.uk-UA.md
│ │ ├── README.vi-VN.md
│ │ ├── README.zh-CN.md
│ │ └── __test__/
│ │ ├── LinkedList.test.js
│ │ └── LinkedListNode.test.js
│ ├── lru-cache/
│ │ ├── LRUCache.js
│ │ ├── LRUCacheOnMap.js
│ │ ├── README.ko-KR.md
│ │ ├── README.md
│ │ └── __test__/
│ │ ├── LRUCache.test.js
│ │ └── LRUCacheOnMap.test.js
│ ├── priority-queue/
│ │ ├── PriorityQueue.js
│ │ ├── README.fr-FR.md
│ │ ├── README.ja-JP.md
│ │ ├── README.ko-KR.md
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── README.ru-RU.md
│ │ ├── README.uk-UA.md
│ │ ├── README.zh-CN.md
│ │ └── __test__/
│ │ └── PriorityQueue.test.js
│ ├── queue/
│ │ ├── Queue.js
│ │ ├── README.fr-FR.md
│ │ ├── README.ja-JP.md
│ │ ├── README.ko-KR.md
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── README.ru-RU.md
│ │ ├── README.uk-UA.md
│ │ ├── README.vi-VN.md
│ │ ├── README.zh-CN.md
│ │ └── __test__/
│ │ └── Queue.test.js
│ ├── stack/
│ │ ├── README.fr-FR.md
│ │ ├── README.ja-JP.md
│ │ ├── README.ko-KR.md
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── README.ru-RU.md
│ │ ├── README.uk-UA.md
│ │ ├── README.vi-VN.md
│ │ ├── README.zh-CN.md
│ │ ├── Stack.js
│ │ └── __test__/
│ │ └── Stack.test.js
│ ├── tree/
│ │ ├── BinaryTreeNode.js
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── README.zh-CN.md
│ │ ├── __test__/
│ │ │ └── BinaryTreeNode.test.js
│ │ ├── avl-tree/
│ │ │ ├── AvlTree.js
│ │ │ ├── README.md
│ │ │ ├── README.pt-BR.md
│ │ │ └── __test__/
│ │ │ └── AvlTRee.test.js
│ │ ├── binary-search-tree/
│ │ │ ├── BinarySearchTree.js
│ │ │ ├── BinarySearchTreeNode.js
│ │ │ ├── README.md
│ │ │ ├── README.pt-BR.md
│ │ │ └── __test__/
│ │ │ ├── BinarySearchTree.test.js
│ │ │ └── BinarySearchTreeNode.test.js
│ │ ├── fenwick-tree/
│ │ │ ├── FenwickTree.js
│ │ │ ├── README.md
│ │ │ ├── README.pt-BR.md
│ │ │ └── __test__/
│ │ │ └── FenwickTree.test.js
│ │ ├── red-black-tree/
│ │ │ ├── README.md
│ │ │ ├── README.pt-BR.md
│ │ │ ├── RedBlackTree.js
│ │ │ └── __test__/
│ │ │ └── RedBlackTree.test.js
│ │ └── segment-tree/
│ │ ├── README.md
│ │ ├── README.pt-BR.md
│ │ ├── SegmentTree.js
│ │ └── __test__/
│ │ └── SegmentTree.test.js
│ └── trie/
│ ├── README.ko-KO.md
│ ├── README.md
│ ├── README.pt-BR.md
│ ├── README.ru-RU.md
│ ├── README.uk-UA.md
│ ├── README.zh-CN.md
│ ├── Trie.js
│ ├── TrieNode.js
│ └── __test__/
│ ├── Trie.test.js
│ └── TrieNode.test.js
├── playground/
│ ├── README.md
│ ├── __test__/
│ │ └── playground.test.js
│ └── playground.js
└── utils/
└── comparator/
├── Comparator.js
└── __test__/
└── Comparator.test.js
SYMBOL INDEX (600 symbols across 195 files)
FILE: src/algorithms/cryptography/hill-cipher/hillCipher.js
function hillCipherEncrypt (line 59) | function hillCipherEncrypt(message, keyString) {
FILE: src/algorithms/cryptography/polynomial-hash/PolynomialHash.js
constant DEFAULT_BASE (line 1) | const DEFAULT_BASE = 37;
constant DEFAULT_MODULUS (line 2) | const DEFAULT_MODULUS = 101;
class PolynomialHash (line 4) | class PolynomialHash {
method constructor (line 9) | constructor({ base = DEFAULT_BASE, modulus = DEFAULT_MODULUS } = {}) {
method hash (line 22) | hash(word) {
method roll (line 49) | roll(prevHash, prevWord, newWord) {
method charToNumber (line 77) | charToNumber(char) {
FILE: src/algorithms/cryptography/polynomial-hash/SimplePolynomialHash.js
constant DEFAULT_BASE (line 1) | const DEFAULT_BASE = 17;
class SimplePolynomialHash (line 3) | class SimplePolynomialHash {
method constructor (line 7) | constructor(base = DEFAULT_BASE) {
method hash (line 24) | hash(word) {
method roll (line 51) | roll(prevHash, prevWord, newWord) {
FILE: src/algorithms/cryptography/rail-fence-cipher/railFenceCipher.js
constant DIRECTIONS (line 13) | const DIRECTIONS = { UP: -1, DOWN: 1 };
function onEachRail (line 61) | function onEachRail(rail, currentRail) {
FILE: src/algorithms/graph/articulation-points/articulationPoints.js
class VisitMetadata (line 6) | class VisitMetadata {
method constructor (line 7) | constructor({ discoveryTime, lowDiscoveryTime }) {
function articulationPoints (line 22) | function articulationPoints(graph) {
FILE: src/algorithms/graph/bellman-ford/bellmanFord.js
function bellmanFord (line 6) | function bellmanFord(graph, startVertex) {
FILE: src/algorithms/graph/breadth-first-search/breadthFirstSearch.js
function initCallbacks (line 19) | function initCallbacks(callbacks = {}) {
function breadthFirstSearch (line 49) | function breadthFirstSearch(graph, startVertex, originalCallbacks) {
FILE: src/algorithms/graph/bridges/graphBridges.js
class VisitMetadata (line 6) | class VisitMetadata {
method constructor (line 7) | constructor({ discoveryTime, lowDiscoveryTime }) {
function graphBridges (line 17) | function graphBridges(graph) {
FILE: src/algorithms/graph/depth-first-search/depthFirstSearch.js
function initCallbacks (line 17) | function initCallbacks(callbacks = {}) {
function depthFirstSearchRecursive (line 48) | function depthFirstSearchRecursive(graph, currentVertex, previousVertex,...
function depthFirstSearch (line 65) | function depthFirstSearch(graph, startVertex, callbacks) {
FILE: src/algorithms/graph/detect-cycle/detectDirectedCycle.js
function detectDirectedCycle (line 8) | function detectDirectedCycle(graph) {
FILE: src/algorithms/graph/detect-cycle/detectUndirectedCycle.js
function detectUndirectedCycle (line 8) | function detectUndirectedCycle(graph) {
FILE: src/algorithms/graph/detect-cycle/detectUndirectedCycleUsingDisjointSet.js
function detectUndirectedCycleUsingDisjointSet (line 8) | function detectUndirectedCycleUsingDisjointSet(graph) {
FILE: src/algorithms/graph/dijkstra/dijkstra.js
function dijkstra (line 15) | function dijkstra(graph, startVertex) {
FILE: src/algorithms/graph/eulerian-path/__test__/eulerianPath.test.js
function findEulerianPathInNotEulerianGraph (line 8) | function findEulerianPathInNotEulerianGraph() {
FILE: src/algorithms/graph/eulerian-path/eulerianPath.js
function eulerianPath (line 9) | function eulerianPath(graph) {
FILE: src/algorithms/graph/floyd-warshall/floydWarshall.js
function floydWarshall (line 5) | function floydWarshall(graph) {
FILE: src/algorithms/graph/hamiltonian-cycle/hamiltonianCycle.js
function isSafe (line 10) | function isSafe(adjacencyMatrix, verticesIndices, cycle, vertexCandidate) {
function isCycle (line 34) | function isCycle(adjacencyMatrix, verticesIndices, cycle) {
function hamiltonianCycleRecursive (line 56) | function hamiltonianCycleRecursive({
function hamiltonianCycle (line 105) | function hamiltonianCycle(graph) {
FILE: src/algorithms/graph/kruskal/__test__/kruskal.test.js
function applyPrimToDirectedGraph (line 8) | function applyPrimToDirectedGraph() {
FILE: src/algorithms/graph/kruskal/kruskal.js
function kruskal (line 9) | function kruskal(graph) {
FILE: src/algorithms/graph/prim/__test__/prim.test.js
function applyPrimToDirectedGraph (line 8) | function applyPrimToDirectedGraph() {
FILE: src/algorithms/graph/prim/prim.js
function prim (line 8) | function prim(graph) {
FILE: src/algorithms/graph/strongly-connected-components/stronglyConnectedComponents.js
function getVerticesSortedByDfsFinishTime (line 8) | function getVerticesSortedByDfsFinishTime(graph) {
function getSCCSets (line 62) | function getSCCSets(graph, verticesByFinishTime) {
function stronglyConnectedComponents (line 119) | function stronglyConnectedComponents(graph) {
FILE: src/algorithms/graph/topological-sorting/topologicalSort.js
function topologicalSort (line 7) | function topologicalSort(graph) {
FILE: src/algorithms/graph/travelling-salesman/bfTravellingSalesman.js
function findAllPaths (line 7) | function findAllPaths(startVertex, paths = [], path = []) {
function getCycleWeight (line 49) | function getCycleWeight(adjacencyMatrix, verticesIndices, cycle) {
function bfTravellingSalesman (line 69) | function bfTravellingSalesman(graph) {
FILE: src/algorithms/image-processing/seam-carving/__tests__/resizeImageWidth.node.js
function pixelsDiff (line 17) | function pixelsDiff(imgA, imgB, threshold = 0) {
FILE: src/algorithms/linked-list/reverse-traversal/reverseTraversal.js
function reverseTraversalRecursive (line 11) | function reverseTraversalRecursive(node, callback) {
function reverseTraversal (line 22) | function reverseTraversal(linkedList, callback) {
FILE: src/algorithms/linked-list/traversal/traversal.js
function traversal (line 11) | function traversal(linkedList, callback) {
FILE: src/algorithms/math/binary-floating-point/bitsToFloat.js
function bitsToFloat (line 59) | function bitsToFloat(bits, precisionConfig) {
function bitsToFloat16 (line 97) | function bitsToFloat16(bits) {
function bitsToFloat32 (line 107) | function bitsToFloat32(bits) {
function bitsToFloat64 (line 117) | function bitsToFloat64(bits) {
FILE: src/algorithms/math/binary-floating-point/floatAsBinaryString.js
function floatAsBinaryString (line 17) | function floatAsBinaryString(floatNumber, byteLength) {
function floatAs64BinaryString (line 49) | function floatAs64BinaryString(floatNumber) {
function floatAs32BinaryString (line 59) | function floatAs32BinaryString(floatNumber) {
FILE: src/algorithms/math/bits/bitLength.js
function bitLength (line 7) | function bitLength(number) {
FILE: src/algorithms/math/bits/bitsDiff.js
function bitsDiff (line 11) | function bitsDiff(numberA, numberB) {
FILE: src/algorithms/math/bits/clearBit.js
function clearBit (line 6) | function clearBit(number, bitPosition) {
FILE: src/algorithms/math/bits/countSetBits.js
function countSetBits (line 5) | function countSetBits(originalNumber) {
FILE: src/algorithms/math/bits/divideByTwo.js
function divideByTwo (line 5) | function divideByTwo(number) {
FILE: src/algorithms/math/bits/fullAdder.js
function fullAdder (line 37) | function fullAdder(a, b) {
FILE: src/algorithms/math/bits/getBit.js
function getBit (line 6) | function getBit(number, bitPosition) {
FILE: src/algorithms/math/bits/isEven.js
function isEven (line 5) | function isEven(number) {
FILE: src/algorithms/math/bits/isPositive.js
function isPositive (line 5) | function isPositive(number) {
FILE: src/algorithms/math/bits/isPowerOfTwo.js
function isPowerOfTwo (line 5) | function isPowerOfTwo(number) {
FILE: src/algorithms/math/bits/multiply.js
function multiply (line 27) | function multiply(a, b) {
FILE: src/algorithms/math/bits/multiplyByTwo.js
function multiplyByTwo (line 5) | function multiplyByTwo(number) {
FILE: src/algorithms/math/bits/multiplyUnsigned.js
function multiplyUnsigned (line 19) | function multiplyUnsigned(number1, number2) {
FILE: src/algorithms/math/bits/setBit.js
function setBit (line 6) | function setBit(number, bitPosition) {
FILE: src/algorithms/math/bits/switchSign.js
function switchSign (line 6) | function switchSign(number) {
FILE: src/algorithms/math/bits/updateBit.js
function updateBit (line 7) | function updateBit(number, bitPosition, bitValue) {
FILE: src/algorithms/math/complex-number/ComplexNumber.js
class ComplexNumber (line 3) | class ComplexNumber {
method constructor (line 11) | constructor({ re = 0, im = 0 } = {}) {
method add (line 20) | add(addend) {
method subtract (line 34) | subtract(subtrahend) {
method multiply (line 48) | multiply(multiplicand) {
method divide (line 62) | divide(divider) {
method conjugate (line 84) | conjugate(number) {
method getRadius (line 97) | getRadius() {
method getPhase (line 105) | getPhase(inRadians = true) {
method getPolarForm (line 139) | getPolarForm(inRadians = true) {
method toComplexNumber (line 153) | toComplexNumber(number) {
FILE: src/algorithms/math/euclidean-algorithm/euclideanAlgorithm.js
function euclideanAlgorithm (line 7) | function euclideanAlgorithm(originalA, originalB) {
FILE: src/algorithms/math/euclidean-algorithm/euclideanAlgorithmIterative.js
function euclideanAlgorithmIterative (line 7) | function euclideanAlgorithmIterative(originalA, originalB) {
FILE: src/algorithms/math/factorial/factorial.js
function factorial (line 5) | function factorial(number) {
FILE: src/algorithms/math/factorial/factorialRecursive.js
function factorialRecursive (line 5) | function factorialRecursive(number) {
FILE: src/algorithms/math/fast-powering/fastPowering.js
function fastPowering (line 11) | function fastPowering(base, power) {
FILE: src/algorithms/math/fibonacci/fibonacci.js
function fibonacci (line 7) | function fibonacci(n) {
FILE: src/algorithms/math/fibonacci/fibonacciNth.js
function fibonacciNth (line 7) | function fibonacciNth(n) {
FILE: src/algorithms/math/fibonacci/fibonacciNthClosedForm.js
function fibonacciClosedForm (line 8) | function fibonacciClosedForm(position) {
FILE: src/algorithms/math/fourier-transform/__test__/FourierTester.js
class FourierTester (line 238) | class FourierTester {
method testDirectFourierTransform (line 242) | static testDirectFourierTransform(fourierTransform) {
method testInverseFourierTransform (line 272) | static testInverseFourierTransform(inverseFourierTransform) {
FILE: src/algorithms/math/fourier-transform/__test__/fastFourierTransform.test.js
function sequencesApproximatelyEqual (line 10) | function sequencesApproximatelyEqual(sequence1, sequence2, delta) {
FILE: src/algorithms/math/fourier-transform/discreteFourierTransform.js
constant CLOSE_TO_ZERO_THRESHOLD (line 3) | const CLOSE_TO_ZERO_THRESHOLD = 1e-10;
function dft (line 22) | function dft(inputAmplitudes, zeroThreshold = CLOSE_TO_ZERO_THRESHOLD) {
FILE: src/algorithms/math/fourier-transform/fastFourierTransform.js
function reverseBits (line 11) | function reverseBits(input, bitsCount) {
function fastFourierTransform (line 33) | function fastFourierTransform(inputData, inverse = false) {
FILE: src/algorithms/math/fourier-transform/inverseDiscreteFourierTransform.js
constant CLOSE_TO_ZERO_THRESHOLD (line 3) | const CLOSE_TO_ZERO_THRESHOLD = 1e-10;
function inverseDiscreteFourierTransform (line 16) | function inverseDiscreteFourierTransform(
FILE: src/algorithms/math/horner-method/classicPolynome.js
function classicPolynome (line 9) | function classicPolynome(coefficients, xVal) {
FILE: src/algorithms/math/horner-method/hornerMethod.js
function hornerMethod (line 9) | function hornerMethod(coefficients, xVal) {
FILE: src/algorithms/math/integer-partition/integerPartition.js
function integerPartition (line 5) | function integerPartition(number) {
FILE: src/algorithms/math/is-power-of-two/isPowerOfTwo.js
function isPowerOfTwo (line 5) | function isPowerOfTwo(number) {
FILE: src/algorithms/math/is-power-of-two/isPowerOfTwoBitwise.js
function isPowerOfTwoBitwise (line 5) | function isPowerOfTwoBitwise(number) {
FILE: src/algorithms/math/least-common-multiple/leastCommonMultiple.js
function leastCommonMultiple (line 9) | function leastCommonMultiple(a, b) {
FILE: src/algorithms/math/liu-hui/liuHui.js
function getNGonSideLength (line 12) | function getNGonSideLength(sideLength, splitCounter) {
function getNGonSideCount (line 31) | function getNGonSideCount(splitCount) {
function liuHui (line 46) | function liuHui(splitCount = 1) {
FILE: src/algorithms/math/pascal-triangle/pascalTriangle.js
function pascalTriangle (line 5) | function pascalTriangle(lineNumber) {
FILE: src/algorithms/math/pascal-triangle/pascalTriangleRecursive.js
function pascalTriangleRecursive (line 5) | function pascalTriangleRecursive(lineNumber) {
FILE: src/algorithms/math/primality-test/__test__/trialDivision.test.js
function primalityTest (line 6) | function primalityTest(testFunction) {
FILE: src/algorithms/math/primality-test/trialDivision.js
function trialDivision (line 5) | function trialDivision(number) {
FILE: src/algorithms/math/prime-factors/__test__/primeFactors.test.js
function approximationError (line 12) | function approximationError(exactCount, approximateCount) {
FILE: src/algorithms/math/prime-factors/primeFactors.js
function primeFactors (line 7) | function primeFactors(n) {
function hardyRamanujan (line 40) | function hardyRamanujan(n) {
FILE: src/algorithms/math/radian/degreeToRadian.js
function degreeToRadian (line 5) | function degreeToRadian(degree) {
FILE: src/algorithms/math/radian/radianToDegree.js
function radianToDegree (line 5) | function radianToDegree(radian) {
FILE: src/algorithms/math/sieve-of-eratosthenes/sieveOfEratosthenes.js
function sieveOfEratosthenes (line 5) | function sieveOfEratosthenes(maxNumber) {
FILE: src/algorithms/math/square-root/__test__/squareRoot.test.js
function failingSquareRoot (line 5) | function failingSquareRoot() {
FILE: src/algorithms/math/square-root/squareRoot.js
function squareRoot (line 9) | function squareRoot(number, tolerance = 0) {
FILE: src/algorithms/ml/k-means/kMeans.js
function KMeans (line 11) | function KMeans(
FILE: src/algorithms/ml/knn/kNN.js
function kNN (line 13) | function kNN(
FILE: src/algorithms/search/binary-search/binarySearch.js
function binarySearch (line 12) | function binarySearch(sortedArray, seekElement, comparatorCallback) {
FILE: src/algorithms/search/interpolation-search/interpolationSearch.js
function interpolationSearch (line 8) | function interpolationSearch(sortedArray, seekElement) {
FILE: src/algorithms/search/jump-search/jumpSearch.js
function jumpSearch (line 11) | function jumpSearch(sortedArray, seekElement, comparatorCallback) {
FILE: src/algorithms/search/linear-search/linearSearch.js
function linearSearch (line 11) | function linearSearch(array, seekElement, comparatorCallback) {
FILE: src/algorithms/sets/cartesian-product/cartesianProduct.js
function cartesianProduct (line 7) | function cartesianProduct(setA, setB) {
FILE: src/algorithms/sets/combination-sum/combinationSum.js
function combinationSumRecursive (line 9) | function combinationSumRecursive(
function combinationSum (line 63) | function combinationSum(candidates, target) {
FILE: src/algorithms/sets/combinations/combineWithRepetitions.js
function combineWithRepetitions (line 6) | function combineWithRepetitions(comboOptions, comboLength) {
FILE: src/algorithms/sets/combinations/combineWithoutRepetitions.js
function combineWithoutRepetitions (line 6) | function combineWithoutRepetitions(comboOptions, comboLength) {
FILE: src/algorithms/sets/fisher-yates/fisherYates.js
function fisherYates (line 5) | function fisherYates(originalArray) {
FILE: src/algorithms/sets/knapsack-problem/Knapsack.js
class Knapsack (line 3) | class Knapsack {
method constructor (line 8) | constructor(possibleItems, weightLimit) {
method sortPossibleItemsByWeight (line 14) | sortPossibleItemsByWeight() {
method sortPossibleItemsByValue (line 30) | sortPossibleItemsByValue() {
method sortPossibleItemsByValuePerWeightRatio (line 46) | sortPossibleItemsByValuePerWeightRatio() {
method solveZeroOneKnapsackProblem (line 64) | solveZeroOneKnapsackProblem() {
method solveUnboundedKnapsackProblem (line 155) | solveUnboundedKnapsackProblem() {
method totalValue (line 182) | get totalValue() {
method totalWeight (line 189) | get totalWeight() {
FILE: src/algorithms/sets/knapsack-problem/KnapsackItem.js
class KnapsackItem (line 1) | class KnapsackItem {
method constructor (line 8) | constructor({ value, weight, itemsInStock = 1 }) {
method totalValue (line 16) | get totalValue() {
method totalWeight (line 20) | get totalWeight() {
method valuePerWeightRatio (line 26) | get valuePerWeightRatio() {
method toString (line 30) | toString() {
FILE: src/algorithms/sets/longest-common-subsequence/longestCommonSubsequence.js
function longestCommonSubsequence (line 6) | function longestCommonSubsequence(set1, set2) {
FILE: src/algorithms/sets/longest-common-subsequence/longestCommonSubsequenceRecursive.js
function longestCommonSubsequenceRecursive (line 9) | function longestCommonSubsequenceRecursive(string1, string2) {
FILE: src/algorithms/sets/longest-increasing-subsequence/dpLongestIncreasingSubsequence.js
function dpLongestIncreasingSubsequence (line 8) | function dpLongestIncreasingSubsequence(sequence) {
FILE: src/algorithms/sets/maximum-subarray/bfMaximumSubarray.js
function bfMaximumSubarray (line 8) | function bfMaximumSubarray(inputArray) {
FILE: src/algorithms/sets/maximum-subarray/dcMaximumSubarraySum.js
function dcMaximumSubarraySum (line 8) | function dcMaximumSubarraySum(inputArray) {
FILE: src/algorithms/sets/maximum-subarray/dpMaximumSubarray.js
function dpMaximumSubarray (line 8) | function dpMaximumSubarray(inputArray) {
FILE: src/algorithms/sets/permutations/permutateWithRepetitions.js
function permutateWithRepetitions (line 6) | function permutateWithRepetitions(
FILE: src/algorithms/sets/permutations/permutateWithoutRepetitions.js
function permutateWithoutRepetitions (line 5) | function permutateWithoutRepetitions(permutationOptions) {
FILE: src/algorithms/sets/power-set/btPowerSet.js
function btPowerSetRecursive (line 8) | function btPowerSetRecursive(originalSet, allSubsets = [[]], currentSubS...
function btPowerSet (line 39) | function btPowerSet(originalSet) {
FILE: src/algorithms/sets/power-set/bwPowerSet.js
function bwPowerSet (line 7) | function bwPowerSet(originalSet) {
FILE: src/algorithms/sets/power-set/caPowerSet.js
function caPowerSet (line 7) | function caPowerSet(originalSet) {
FILE: src/algorithms/sets/shortest-common-supersequence/shortestCommonSupersequence.js
function shortestCommonSupersequence (line 9) | function shortestCommonSupersequence(set1, set2) {
FILE: src/algorithms/sorting/Sort.js
class Sort (line 11) | class Sort {
method constructor (line 12) | constructor(originalCallbacks) {
method initSortingCallbacks (line 21) | static initSortingCallbacks(originalCallbacks) {
method sort (line 31) | sort() {
FILE: src/algorithms/sorting/SortTester.js
class SortTester (line 8) | class SortTester {
method testSort (line 9) | static testSort(SortingClass) {
method testNegativeNumbersSort (line 23) | static testNegativeNumbersSort(SortingClass) {
method testSortWithCustomComparator (line 28) | static testSortWithCustomComparator(SortingClass) {
method testSortStability (line 47) | static testSortStability(SortingClass) {
method testAlgorithmTimeComplexity (line 63) | static testAlgorithmTimeComplexity(SortingClass, arrayToBeSorted, numb...
FILE: src/algorithms/sorting/__test__/Sort.test.js
function doForbiddenSort (line 5) | function doForbiddenSort() {
FILE: src/algorithms/sorting/bubble-sort/BubbleSort.js
class BubbleSort (line 3) | class BubbleSort extends Sort {
method sort (line 4) | sort(originalArray) {
FILE: src/algorithms/sorting/bubble-sort/__test__/BubbleSort.test.js
constant SORTED_ARRAY_VISITING_COUNT (line 11) | const SORTED_ARRAY_VISITING_COUNT = 20;
constant NOT_SORTED_ARRAY_VISITING_COUNT (line 12) | const NOT_SORTED_ARRAY_VISITING_COUNT = 189;
constant REVERSE_SORTED_ARRAY_VISITING_COUNT (line 13) | const REVERSE_SORTED_ARRAY_VISITING_COUNT = 209;
constant EQUAL_ARRAY_VISITING_COUNT (line 14) | const EQUAL_ARRAY_VISITING_COUNT = 20;
FILE: src/algorithms/sorting/bucket-sort/BucketSort.js
function BucketSort (line 10) | function BucketSort(arr, bucketsNum = 1) {
FILE: src/algorithms/sorting/counting-sort/CountingSort.js
class CountingSort (line 3) | class CountingSort extends Sort {
method sort (line 9) | sort(originalArray, smallestElement = undefined, biggestElement = unde...
FILE: src/algorithms/sorting/counting-sort/__test__/CountingSort.test.js
constant SORTED_ARRAY_VISITING_COUNT (line 11) | const SORTED_ARRAY_VISITING_COUNT = 60;
constant NOT_SORTED_ARRAY_VISITING_COUNT (line 12) | const NOT_SORTED_ARRAY_VISITING_COUNT = 60;
constant REVERSE_SORTED_ARRAY_VISITING_COUNT (line 13) | const REVERSE_SORTED_ARRAY_VISITING_COUNT = 60;
constant EQUAL_ARRAY_VISITING_COUNT (line 14) | const EQUAL_ARRAY_VISITING_COUNT = 60;
FILE: src/algorithms/sorting/heap-sort/HeapSort.js
class HeapSort (line 4) | class HeapSort extends Sort {
method sort (line 5) | sort(originalArray) {
FILE: src/algorithms/sorting/heap-sort/__test__/HeapSort.test.js
constant SORTED_ARRAY_VISITING_COUNT (line 13) | const SORTED_ARRAY_VISITING_COUNT = 40;
constant NOT_SORTED_ARRAY_VISITING_COUNT (line 14) | const NOT_SORTED_ARRAY_VISITING_COUNT = 40;
constant REVERSE_SORTED_ARRAY_VISITING_COUNT (line 15) | const REVERSE_SORTED_ARRAY_VISITING_COUNT = 40;
constant EQUAL_ARRAY_VISITING_COUNT (line 16) | const EQUAL_ARRAY_VISITING_COUNT = 40;
FILE: src/algorithms/sorting/insertion-sort/InsertionSort.js
class InsertionSort (line 3) | class InsertionSort extends Sort {
method sort (line 4) | sort(originalArray) {
FILE: src/algorithms/sorting/insertion-sort/__test__/InsertionSort.test.js
constant SORTED_ARRAY_VISITING_COUNT (line 11) | const SORTED_ARRAY_VISITING_COUNT = 19;
constant NOT_SORTED_ARRAY_VISITING_COUNT (line 12) | const NOT_SORTED_ARRAY_VISITING_COUNT = 100;
constant REVERSE_SORTED_ARRAY_VISITING_COUNT (line 13) | const REVERSE_SORTED_ARRAY_VISITING_COUNT = 209;
constant EQUAL_ARRAY_VISITING_COUNT (line 14) | const EQUAL_ARRAY_VISITING_COUNT = 19;
FILE: src/algorithms/sorting/merge-sort/MergeSort.js
class MergeSort (line 3) | class MergeSort extends Sort {
method sort (line 4) | sort(originalArray) {
method mergeSortedArrays (line 26) | mergeSortedArrays(leftArray, rightArray) {
FILE: src/algorithms/sorting/merge-sort/__test__/MergeSort.test.js
constant SORTED_ARRAY_VISITING_COUNT (line 11) | const SORTED_ARRAY_VISITING_COUNT = 79;
constant NOT_SORTED_ARRAY_VISITING_COUNT (line 12) | const NOT_SORTED_ARRAY_VISITING_COUNT = 102;
constant REVERSE_SORTED_ARRAY_VISITING_COUNT (line 13) | const REVERSE_SORTED_ARRAY_VISITING_COUNT = 87;
constant EQUAL_ARRAY_VISITING_COUNT (line 14) | const EQUAL_ARRAY_VISITING_COUNT = 79;
FILE: src/algorithms/sorting/quick-sort/QuickSort.js
class QuickSort (line 3) | class QuickSort extends Sort {
method sort (line 8) | sort(originalArray) {
FILE: src/algorithms/sorting/quick-sort/QuickSortInPlace.js
class QuickSortInPlace (line 3) | class QuickSortInPlace extends Sort {
method sort (line 15) | sort(
FILE: src/algorithms/sorting/quick-sort/__test__/QuickSort.test.js
constant SORTED_ARRAY_VISITING_COUNT (line 11) | const SORTED_ARRAY_VISITING_COUNT = 190;
constant NOT_SORTED_ARRAY_VISITING_COUNT (line 12) | const NOT_SORTED_ARRAY_VISITING_COUNT = 62;
constant REVERSE_SORTED_ARRAY_VISITING_COUNT (line 13) | const REVERSE_SORTED_ARRAY_VISITING_COUNT = 190;
constant EQUAL_ARRAY_VISITING_COUNT (line 14) | const EQUAL_ARRAY_VISITING_COUNT = 19;
FILE: src/algorithms/sorting/quick-sort/__test__/QuickSortInPlace.test.js
constant SORTED_ARRAY_VISITING_COUNT (line 11) | const SORTED_ARRAY_VISITING_COUNT = 19;
constant NOT_SORTED_ARRAY_VISITING_COUNT (line 12) | const NOT_SORTED_ARRAY_VISITING_COUNT = 12;
constant REVERSE_SORTED_ARRAY_VISITING_COUNT (line 13) | const REVERSE_SORTED_ARRAY_VISITING_COUNT = 19;
constant EQUAL_ARRAY_VISITING_COUNT (line 14) | const EQUAL_ARRAY_VISITING_COUNT = 19;
FILE: src/algorithms/sorting/radix-sort/RadixSort.js
constant BASE_CHAR_CODE (line 4) | const BASE_CHAR_CODE = 97;
constant NUMBER_OF_POSSIBLE_DIGITS (line 5) | const NUMBER_OF_POSSIBLE_DIGITS = 10;
constant ENGLISH_ALPHABET_LENGTH (line 6) | const ENGLISH_ALPHABET_LENGTH = 26;
class RadixSort (line 8) | class RadixSort extends Sort {
method sort (line 13) | sort(originalArray) {
method placeElementsInNumberBuckets (line 39) | placeElementsInNumberBuckets(array, index) {
method placeElementsInCharacterBuckets (line 69) | placeElementsInCharacterBuckets(array, index, numPasses) {
method getCharCodeOfElementAtIndex (line 87) | getCharCodeOfElementAtIndex(element, index, numPasses) {
method determineNumPasses (line 106) | determineNumPasses(array) {
method getLengthOfLongestElement (line 114) | getLengthOfLongestElement(array) {
method isArrayOfNumbers (line 128) | isArrayOfNumbers(array) {
method createBuckets (line 137) | createBuckets(numBuckets) {
method isNumber (line 149) | isNumber(element) {
FILE: src/algorithms/sorting/radix-sort/__test__/RadixSort.test.js
constant ARRAY_OF_STRINGS_VISIT_COUNT (line 5) | const ARRAY_OF_STRINGS_VISIT_COUNT = 24;
constant ARRAY_OF_INTEGERS_VISIT_COUNT (line 6) | const ARRAY_OF_INTEGERS_VISIT_COUNT = 77;
FILE: src/algorithms/sorting/selection-sort/SelectionSort.js
class SelectionSort (line 3) | class SelectionSort extends Sort {
method sort (line 4) | sort(originalArray) {
FILE: src/algorithms/sorting/selection-sort/__test__/SelectionSort.test.js
constant SORTED_ARRAY_VISITING_COUNT (line 11) | const SORTED_ARRAY_VISITING_COUNT = 209;
constant NOT_SORTED_ARRAY_VISITING_COUNT (line 12) | const NOT_SORTED_ARRAY_VISITING_COUNT = 209;
constant REVERSE_SORTED_ARRAY_VISITING_COUNT (line 13) | const REVERSE_SORTED_ARRAY_VISITING_COUNT = 209;
constant EQUAL_ARRAY_VISITING_COUNT (line 14) | const EQUAL_ARRAY_VISITING_COUNT = 209;
FILE: src/algorithms/sorting/shell-sort/ShellSort.js
class ShellSort (line 3) | class ShellSort extends Sort {
method sort (line 4) | sort(originalArray) {
FILE: src/algorithms/sorting/shell-sort/__test__/ShellSort.test.js
constant SORTED_ARRAY_VISITING_COUNT (line 11) | const SORTED_ARRAY_VISITING_COUNT = 320;
constant NOT_SORTED_ARRAY_VISITING_COUNT (line 12) | const NOT_SORTED_ARRAY_VISITING_COUNT = 320;
constant REVERSE_SORTED_ARRAY_VISITING_COUNT (line 13) | const REVERSE_SORTED_ARRAY_VISITING_COUNT = 320;
constant EQUAL_ARRAY_VISITING_COUNT (line 14) | const EQUAL_ARRAY_VISITING_COUNT = 320;
FILE: src/algorithms/stack/valid-parentheses/validParentheses.js
function isValid (line 16) | function isValid(parenthesesString) {
FILE: src/algorithms/statistics/weighted-random/weightedRandom.js
function weightedRandom (line 16) | function weightedRandom(items, weights) {
FILE: src/algorithms/string/hamming-distance/hammingDistance.js
function hammingDistance (line 6) | function hammingDistance(a, b) {
FILE: src/algorithms/string/knuth-morris-pratt/knuthMorrisPratt.js
function buildPatternTable (line 6) | function buildPatternTable(word) {
function knuthMorrisPratt (line 32) | function knuthMorrisPratt(text, word) {
FILE: src/algorithms/string/levenshtein-distance/levenshteinDistance.js
function levenshteinDistance (line 6) | function levenshteinDistance(a, b) {
FILE: src/algorithms/string/longest-common-substring/longestCommonSubstring.js
function longestCommonSubstring (line 8) | function longestCommonSubstring(string1, string2) {
FILE: src/algorithms/string/palindrome/isPalindrome.js
function isPalindrome (line 6) | function isPalindrome(string) {
FILE: src/algorithms/string/rabin-karp/rabinKarp.js
function rabinKarp (line 8) | function rabinKarp(text, word) {
FILE: src/algorithms/string/regular-expression-matching/regularExpressionMatching.js
constant ZERO_OR_MORE_CHARS (line 1) | const ZERO_OR_MORE_CHARS = '*';
constant ANY_CHAR (line 2) | const ANY_CHAR = '.';
function regularExpressionMatching (line 11) | function regularExpressionMatching(string, pattern) {
FILE: src/algorithms/string/z-algorithm/zAlgorithm.js
constant SEPARATOR (line 2) | const SEPARATOR = '$';
function buildZArray (line 8) | function buildZArray(zString) {
function zAlgorithm (line 106) | function zAlgorithm(text, word) {
FILE: src/algorithms/tree/breadth-first-search/breadthFirstSearch.js
function initCallbacks (line 15) | function initCallbacks(callbacks = {}) {
function breadthFirstSearch (line 32) | function breadthFirstSearch(rootNode, originalCallbacks) {
FILE: src/algorithms/tree/depth-first-search/depthFirstSearch.js
function initCallbacks (line 18) | function initCallbacks(callbacks = {}) {
function depthFirstSearchRecursive (line 43) | function depthFirstSearchRecursive(node, callbacks) {
function depthFirstSearch (line 70) | function depthFirstSearch(rootNode, callbacks) {
FILE: src/algorithms/uncategorized/hanoi-tower/hanoiTower.js
function hanoiTowerRecursive (line 10) | function hanoiTowerRecursive({
function hanoiTower (line 61) | function hanoiTower({
FILE: src/algorithms/uncategorized/jump-game/backtrackingJumpGame.js
function backtrackingJumpGame (line 15) | function backtrackingJumpGame(numbers, startIndex = 0, currentJumps = []) {
FILE: src/algorithms/uncategorized/jump-game/dpBottomUpJumpGame.js
function dpBottomUpJumpGame (line 19) | function dpBottomUpJumpGame(numbers) {
FILE: src/algorithms/uncategorized/jump-game/dpTopDownJumpGame.js
function dpTopDownJumpGame (line 20) | function dpTopDownJumpGame(
FILE: src/algorithms/uncategorized/jump-game/greedyJumpGame.js
function greedyJumpGame (line 20) | function greedyJumpGame(numbers) {
FILE: src/algorithms/uncategorized/knight-tour/knightTour.js
function getPossibleMoves (line 6) | function getPossibleMoves(chessboard, position) {
function isMoveAllowed (line 31) | function isMoveAllowed(chessboard, move) {
function isBoardCompletelyVisited (line 40) | function isBoardCompletelyVisited(chessboard, moves) {
function knightTourRecursive (line 52) | function knightTourRecursive(chessboard, moves) {
function knightTour (line 96) | function knightTour(chessboardSize) {
FILE: src/algorithms/uncategorized/n-queens/QueenPosition.js
class QueenPosition (line 4) | class QueenPosition {
method constructor (line 9) | constructor(rowIndex, columnIndex) {
method leftDiagonal (line 17) | get leftDiagonal() {
method rightDiagonal (line 28) | get rightDiagonal() {
method toString (line 36) | toString() {
FILE: src/algorithms/uncategorized/n-queens/nQueens.js
function isSafe (line 9) | function isSafe(queensPositions, rowIndex, columnIndex) {
function nQueensRecursive (line 48) | function nQueensRecursive(solutions, previousQueensPositions, queensCoun...
function nQueens (line 88) | function nQueens(queensCount) {
FILE: src/algorithms/uncategorized/n-queens/nQueensBitwise.js
function nQueensBitwiseRecursive (line 14) | function nQueensBitwiseRecursive(
function nQueensBitwise (line 99) | function nQueensBitwise(boardSize) {
FILE: src/algorithms/uncategorized/rain-terraces/bfRainTerraces.js
function bfRainTerraces (line 7) | function bfRainTerraces(terraces) {
FILE: src/algorithms/uncategorized/rain-terraces/dpRainTerraces.js
function dpRainTerraces (line 7) | function dpRainTerraces(terraces) {
FILE: src/algorithms/uncategorized/recursive-staircase/recursiveStaircaseBF.js
function recursiveStaircaseBF (line 7) | function recursiveStaircaseBF(stairsNum) {
FILE: src/algorithms/uncategorized/recursive-staircase/recursiveStaircaseDP.js
function recursiveStaircaseDP (line 7) | function recursiveStaircaseDP(stairsNum) {
FILE: src/algorithms/uncategorized/recursive-staircase/recursiveStaircaseIT.js
function recursiveStaircaseIT (line 7) | function recursiveStaircaseIT(stairsNum) {
FILE: src/algorithms/uncategorized/recursive-staircase/recursiveStaircaseMEM.js
function recursiveStaircaseMEM (line 7) | function recursiveStaircaseMEM(totalStairs) {
FILE: src/algorithms/uncategorized/square-matrix-rotation/squareMatrixRotation.js
function squareMatrixRotation (line 5) | function squareMatrixRotation(originalMatrix) {
FILE: src/algorithms/uncategorized/unique-paths/btUniquePaths.js
function btUniquePaths (line 10) | function btUniquePaths(width, height, steps = [[0, 0]], uniqueSteps = 0) {
FILE: src/algorithms/uncategorized/unique-paths/dpUniquePaths.js
function dpUniquePaths (line 8) | function dpUniquePaths(width, height) {
FILE: src/algorithms/uncategorized/unique-paths/uniquePaths.js
function uniquePaths (line 8) | function uniquePaths(width, height) {
FILE: src/data-structures/bloom-filter/BloomFilter.js
class BloomFilter (line 1) | class BloomFilter {
method constructor (line 5) | constructor(size = 100) {
method insert (line 15) | insert(item) {
method mayContain (line 26) | mayContain(item) {
method createStore (line 49) | createStore(size) {
method hash1 (line 73) | hash1(item) {
method hash2 (line 90) | hash2(item) {
method hash3 (line 105) | hash3(item) {
method getHashValues (line 124) | getHashValues(item) {
FILE: src/data-structures/disjoint-set/DisjointSet.js
class DisjointSet (line 3) | class DisjointSet {
method constructor (line 7) | constructor(keyCallback) {
method makeSet (line 16) | makeSet(itemValue) {
method find (line 33) | find(itemValue) {
method union (line 53) | union(valueA, valueB) {
method inSameSet (line 87) | inSameSet(valueA, valueB) {
FILE: src/data-structures/disjoint-set/DisjointSetAdhoc.js
class DisjointSetAdhoc (line 19) | class DisjointSetAdhoc {
method constructor (line 24) | constructor(size) {
method find (line 40) | find(a) {
method union (line 52) | union(a, b) {
method connected (line 73) | connected(a, b) {
FILE: src/data-structures/disjoint-set/DisjointSetItem.js
class DisjointSetItem (line 1) | class DisjointSetItem {
method constructor (line 6) | constructor(value, keyCallback) {
method getKey (line 17) | getKey() {
method getRoot (line 30) | getRoot() {
method isRoot (line 37) | isRoot() {
method getRank (line 46) | getRank() {
method getChildren (line 68) | getChildren() {
method setParent (line 77) | setParent(parentItem, forceSettingParentChild = true) {
method addChild (line 90) | addChild(childItem) {
FILE: src/data-structures/disjoint-set/__test__/DisjointSet.test.js
function mergeNotExistingSets (line 5) | function mergeNotExistingSets() {
function checkNotExistingSets (line 11) | function checkNotExistingSets() {
FILE: src/data-structures/doubly-linked-list/DoublyLinkedList.js
class DoublyLinkedList (line 4) | class DoublyLinkedList {
method constructor (line 8) | constructor(comparatorFunction) {
method prepend (line 22) | prepend(value) {
method append (line 46) | append(value) {
method delete (line 73) | delete(value) {
method find (line 129) | find({ value = undefined, callback = undefined }) {
method deleteTail (line 156) | deleteTail() {
method deleteHead (line 183) | deleteHead() {
method toArray (line 204) | toArray() {
method fromArray (line 220) | fromArray(values) {
method toString (line 230) | toString(callback) {
method reverse (line 238) | reverse() {
FILE: src/data-structures/doubly-linked-list/DoublyLinkedListNode.js
class DoublyLinkedListNode (line 1) | class DoublyLinkedListNode {
method constructor (line 2) | constructor(value, next = null, previous = null) {
method toString (line 8) | toString(callback) {
FILE: src/data-structures/graph/Graph.js
class Graph (line 1) | class Graph {
method constructor (line 5) | constructor(isDirected = false) {
method addVertex (line 15) | addVertex(newVertex) {
method getVertexByKey (line 31) | getVertexByKey(vertexKey) {
method getNeighbors (line 39) | getNeighbors(vertex) {
method getAllVertices (line 46) | getAllVertices() {
method getAllEdges (line 53) | getAllEdges() {
method addEdge (line 61) | addEdge(edge) {
method deleteEdge (line 101) | deleteEdge(edge) {
method findEdge (line 122) | findEdge(startVertex, endVertex) {
method getWeight (line 135) | getWeight() {
method reverse (line 145) | reverse() {
method getVerticesIndices (line 164) | getVerticesIndices() {
method getAdjacencyMatrix (line 176) | getAdjacencyMatrix() {
method toString (line 200) | toString() {
FILE: src/data-structures/graph/GraphEdge.js
class GraphEdge (line 1) | class GraphEdge {
method constructor (line 8) | constructor(startVertex, endVertex, weight = 0, key = null) {
method getKey (line 15) | getKey() {
method reverse (line 31) | reverse() {
method toString (line 42) | toString() {
FILE: src/data-structures/graph/GraphVertex.js
class GraphVertex (line 3) | class GraphVertex {
method constructor (line 7) | constructor(value) {
method addEdge (line 34) | addEdge(edge) {
method deleteEdge (line 43) | deleteEdge(edge) {
method getNeighbors (line 50) | getNeighbors() {
method getEdges (line 66) | getEdges() {
method getDegree (line 73) | getDegree() {
method hasEdge (line 81) | hasEdge(requiredEdge) {
method hasNeighbor (line 93) | hasNeighbor(vertex) {
method findEdge (line 105) | findEdge(vertex) {
method getKey (line 118) | getKey() {
method deleteAllEdges (line 125) | deleteAllEdges() {
method toString (line 135) | toString(callback) {
FILE: src/data-structures/graph/__test__/Graph.test.js
function addSameEdgeTwice (line 145) | function addSameEdgeTwice() {
function addSameEdgeTwice (line 162) | function addSameEdgeTwice() {
function deleteNotExistingEdge (line 265) | function deleteNotExistingEdge() {
FILE: src/data-structures/graph/__test__/GraphEdge.test.js
method toString (line 57) | toString() { return 'custom_key'; }
FILE: src/data-structures/graph/__test__/GraphVertex.test.js
function createEmptyVertex (line 8) | function createEmptyVertex() {
method toString (line 197) | toString() { return 'A'; }
FILE: src/data-structures/hash-table/HashTable.js
class HashTable (line 9) | class HashTable {
method constructor (line 13) | constructor(hashTableSize = defaultHashTableSize) {
method hash (line 27) | hash(key) {
method set (line 51) | set(key, value) {
method delete (line 70) | delete(key) {
method get (line 87) | get(key) {
method has (line 98) | has(key) {
method getKeys (line 105) | getKeys() {
method getValues (line 114) | getValues() {
FILE: src/data-structures/heap/Heap.js
class Heap (line 6) | class Heap {
method constructor (line 11) | constructor(comparatorFunction) {
method getLeftChildIndex (line 25) | getLeftChildIndex(parentIndex) {
method getRightChildIndex (line 33) | getRightChildIndex(parentIndex) {
method getParentIndex (line 41) | getParentIndex(childIndex) {
method hasParent (line 49) | hasParent(childIndex) {
method hasLeftChild (line 57) | hasLeftChild(parentIndex) {
method hasRightChild (line 65) | hasRightChild(parentIndex) {
method leftChild (line 73) | leftChild(parentIndex) {
method rightChild (line 81) | rightChild(parentIndex) {
method parent (line 89) | parent(childIndex) {
method swap (line 97) | swap(indexOne, indexTwo) {
method peek (line 106) | peek() {
method poll (line 117) | poll() {
method add (line 139) | add(item) {
method remove (line 150) | remove(item, comparator = this.compare) {
method find (line 194) | find(item, comparator = this.compare) {
method isEmpty (line 209) | isEmpty() {
method toString (line 216) | toString() {
method heapifyUp (line 223) | heapifyUp(customStartIndex) {
method heapifyDown (line 241) | heapifyDown(customStartIndex = 0) {
method pairIsInCorrectOrder (line 280) | pairIsInCorrectOrder(firstElement, secondElement) {
FILE: src/data-structures/heap/MaxHeap.js
class MaxHeap (line 3) | class MaxHeap extends Heap {
method pairIsInCorrectOrder (line 13) | pairIsInCorrectOrder(firstElement, secondElement) {
FILE: src/data-structures/heap/MaxHeapAdhoc.js
class MaxHeapAdhoc (line 7) | class MaxHeapAdhoc {
method constructor (line 8) | constructor(heap = []) {
method add (line 13) | add(num) {
method peek (line 18) | peek() {
method poll (line 22) | poll() {
method isEmpty (line 31) | isEmpty() {
method toString (line 35) | toString() {
method heapifyUp (line 39) | heapifyUp() {
method heapifyDown (line 49) | heapifyDown() {
method getLeftChildIndex (line 80) | getLeftChildIndex(parentIndex) {
method getRightChildIndex (line 84) | getRightChildIndex(parentIndex) {
method getParentIndex (line 88) | getParentIndex(childIndex) {
method hasLeftChild (line 92) | hasLeftChild(parentIndex) {
method hasRightChild (line 96) | hasRightChild(parentIndex) {
method leftChild (line 100) | leftChild(parentIndex) {
method rightChild (line 104) | rightChild(parentIndex) {
method swap (line 108) | swap(indexOne, indexTwo) {
FILE: src/data-structures/heap/MinHeap.js
class MinHeap (line 3) | class MinHeap extends Heap {
method pairIsInCorrectOrder (line 13) | pairIsInCorrectOrder(firstElement, secondElement) {
FILE: src/data-structures/heap/MinHeapAdhoc.js
class MinHeapAdhoc (line 7) | class MinHeapAdhoc {
method constructor (line 8) | constructor(heap = []) {
method add (line 13) | add(num) {
method peek (line 18) | peek() {
method poll (line 22) | poll() {
method isEmpty (line 31) | isEmpty() {
method toString (line 35) | toString() {
method heapifyUp (line 39) | heapifyUp() {
method heapifyDown (line 49) | heapifyDown() {
method getLeftChildIndex (line 82) | getLeftChildIndex(parentIndex) {
method getRightChildIndex (line 86) | getRightChildIndex(parentIndex) {
method getParentIndex (line 90) | getParentIndex(childIndex) {
method hasLeftChild (line 94) | hasLeftChild(parentIndex) {
method hasRightChild (line 98) | hasRightChild(parentIndex) {
method leftChild (line 102) | leftChild(parentIndex) {
method rightChild (line 106) | rightChild(parentIndex) {
method swap (line 110) | swap(indexOne, indexTwo) {
FILE: src/data-structures/linked-list/LinkedList.js
class LinkedList (line 4) | class LinkedList {
method constructor (line 8) | constructor(comparatorFunction) {
method prepend (line 22) | prepend(value) {
method append (line 39) | append(value) {
method insert (line 62) | insert(value, rawIndex) {
method delete (line 95) | delete(value) {
method find (line 137) | find({ value = undefined, callback = undefined }) {
method deleteTail (line 164) | deleteTail() {
method deleteHead (line 195) | deleteHead() {
method fromArray (line 216) | fromArray(values) {
method toArray (line 225) | toArray() {
method toString (line 241) | toString(callback) {
method reverse (line 249) | reverse() {
FILE: src/data-structures/linked-list/LinkedListNode.js
class LinkedListNode (line 1) | class LinkedListNode {
method constructor (line 2) | constructor(value, next = null) {
method toString (line 7) | toString(callback) {
FILE: src/data-structures/lru-cache/LRUCache.js
class LinkedListNode (line 7) | class LinkedListNode {
method constructor (line 15) | constructor(key, val, prev = null, next = null) {
class LRUCache (line 31) | class LRUCache {
method constructor (line 36) | constructor(capacity) {
method get (line 50) | get(key) {
method set (line 63) | set(key, val) {
method promote (line 80) | promote(node) {
method append (line 89) | append(node) {
method evict (line 118) | evict(node) {
FILE: src/data-structures/lru-cache/LRUCacheOnMap.js
class LRUCacheOnMap (line 11) | class LRUCacheOnMap {
method constructor (line 16) | constructor(capacity) {
method get (line 27) | get(key) {
method set (line 41) | set(key, val) {
FILE: src/data-structures/priority-queue/PriorityQueue.js
class PriorityQueue (line 6) | class PriorityQueue extends MinHeap {
method constructor (line 7) | constructor() {
method add (line 25) | add(item, priority = 0) {
method remove (line 37) | remove(item, customFindingComparator) {
method changePriority (line 49) | changePriority(item, priority) {
method findByValue (line 60) | findByValue(item) {
method hasValue (line 69) | hasValue(item) {
method comparePriority (line 79) | comparePriority(a, b) {
method compareValue (line 92) | compareValue(a, b) {
FILE: src/data-structures/queue/Queue.js
class Queue (line 3) | class Queue {
method constructor (line 4) | constructor() {
method isEmpty (line 15) | isEmpty() {
method peek (line 23) | peek() {
method enqueue (line 36) | enqueue(value) {
method dequeue (line 45) | dequeue() {
method toString (line 54) | toString(callback) {
FILE: src/data-structures/stack/Stack.js
class Stack (line 3) | class Stack {
method constructor (line 4) | constructor() {
method isEmpty (line 14) | isEmpty() {
method peek (line 22) | peek() {
method push (line 35) | push(value) {
method pop (line 44) | pop() {
method toArray (line 54) | toArray() {
method toString (line 64) | toString(callback) {
FILE: src/data-structures/tree/BinaryTreeNode.js
class BinaryTreeNode (line 4) | class BinaryTreeNode {
method constructor (line 8) | constructor(value = null) {
method leftHeight (line 24) | get leftHeight() {
method rightHeight (line 35) | get rightHeight() {
method height (line 46) | get height() {
method balanceFactor (line 53) | get balanceFactor() {
method uncle (line 61) | get uncle() {
method setValue (line 92) | setValue(value) {
method setLeft (line 102) | setLeft(node) {
method setRight (line 123) | setRight(node) {
method removeChild (line 144) | removeChild(nodeToRemove) {
method replaceChild (line 163) | replaceChild(nodeToReplace, replacementNode) {
method copyNode (line 185) | static copyNode(sourceNode, targetNode) {
method traverseInOrder (line 194) | traverseInOrder() {
method toString (line 216) | toString() {
FILE: src/data-structures/tree/avl-tree/AvlTree.js
class AvlTree (line 3) | class AvlTree extends BinarySearchTree {
method insert (line 7) | insert(value) {
method remove (line 23) | remove(value) {
method balance (line 34) | balance(node) {
method rotateLeftLeft (line 60) | rotateLeftLeft(rootNode) {
method rotateLeftRight (line 86) | rotateLeftRight(rootNode) {
method rotateRightLeft (line 114) | rotateRightLeft(rootNode) {
method rotateRightRight (line 141) | rotateRightRight(rootNode) {
FILE: src/data-structures/tree/binary-search-tree/BinarySearchTree.js
class BinarySearchTree (line 3) | class BinarySearchTree {
method constructor (line 7) | constructor(nodeValueCompareFunction) {
method insert (line 18) | insert(value) {
method contains (line 26) | contains(value) {
method remove (line 34) | remove(value) {
method toString (line 41) | toString() {
FILE: src/data-structures/tree/binary-search-tree/BinarySearchTreeNode.js
class BinarySearchTreeNode (line 4) | class BinarySearchTreeNode extends BinaryTreeNode {
method constructor (line 9) | constructor(value = null, compareFunction = undefined) {
method insert (line 21) | insert(value) {
method find (line 59) | find(value) {
method contains (line 82) | contains(value) {
method remove (line 90) | remove(value) {
method findMin (line 144) | findMin() {
FILE: src/data-structures/tree/binary-search-tree/__test__/BinarySearchTreeNode.test.js
function removeNotExistingElementFromTree (line 209) | function removeNotExistingElementFromTree() {
FILE: src/data-structures/tree/fenwick-tree/FenwickTree.js
class FenwickTree (line 1) | class FenwickTree {
method constructor (line 8) | constructor(arraySize) {
method increase (line 22) | increase(position, value) {
method query (line 40) | query(position) {
method queryRange (line 61) | queryRange(leftIndex, rightIndex) {
FILE: src/data-structures/tree/red-black-tree/RedBlackTree.js
constant RED_BLACK_TREE_COLORS (line 4) | const RED_BLACK_TREE_COLORS = {
constant COLOR_PROP_NAME (line 10) | const COLOR_PROP_NAME = 'color';
class RedBlackTree (line 12) | class RedBlackTree extends BinarySearchTree {
method insert (line 17) | insert(value) {
method remove (line 39) | remove(value) {
method balance (line 46) | balance(node) {
method leftLeftRotation (line 123) | leftLeftRotation(grandParentNode) {
method leftRightRotation (line 170) | leftRightRotation(grandParentNode) {
method rightRightRotation (line 198) | rightRightRotation(grandParentNode) {
method rightLeftRotation (line 245) | rightLeftRotation(grandParentNode) {
method makeNodeRed (line 272) | makeNodeRed(node) {
method makeNodeBlack (line 282) | makeNodeBlack(node) {
method isNodeRed (line 292) | isNodeRed(node) {
method isNodeBlack (line 300) | isNodeBlack(node) {
method isNodeColored (line 308) | isNodeColored(node) {
method swapNodeColors (line 316) | swapNodeColors(firstNode, secondNode) {
FILE: src/data-structures/tree/segment-tree/SegmentTree.js
class SegmentTree (line 3) | class SegmentTree {
method constructor (line 9) | constructor(inputArray, operation, operationFallback) {
method initSegmentTree (line 24) | initSegmentTree(inputArray) {
method buildSegmentTree (line 48) | buildSegmentTree() {
method buildTreeRecursively (line 62) | buildTreeRecursively(leftInputIndex, rightInputIndex, position) {
method rangeQuery (line 94) | rangeQuery(queryLeftIndex, queryRightIndex) {
method rangeQueryRecursive (line 118) | rangeQueryRecursive(queryLeftIndex, queryRightIndex, leftIndex, rightI...
method getLeftChildIndex (line 156) | getLeftChildIndex(parentIndex) {
method getRightChildIndex (line 165) | getRightChildIndex(parentIndex) {
FILE: src/data-structures/trie/Trie.js
constant HEAD_CHARACTER (line 4) | const HEAD_CHARACTER = '*';
class Trie (line 6) | class Trie {
method constructor (line 7) | constructor() {
method addWord (line 15) | addWord(word) {
method deleteWord (line 31) | deleteWord(word) {
method suggestNextCharacters (line 70) | suggestNextCharacters(word) {
method doesWordExist (line 86) | doesWordExist(word) {
method getLastCharacterNode (line 96) | getLastCharacterNode(word) {
FILE: src/data-structures/trie/TrieNode.js
class TrieNode (line 3) | class TrieNode {
method constructor (line 8) | constructor(character, isCompleteWord = false) {
method getChild (line 18) | getChild(character) {
method addChild (line 27) | addChild(character, isCompleteWord = false) {
method removeChild (line 44) | removeChild(character) {
method hasChild (line 65) | hasChild(character) {
method hasChildren (line 73) | hasChildren() {
method suggestChildren (line 80) | suggestChildren() {
method toString (line 87) | toString() {
FILE: src/playground/playground.js
function playground (line 7) | function playground() {
FILE: src/utils/comparator/Comparator.js
class Comparator (line 1) | class Comparator {
method constructor (line 7) | constructor(compareFunction) {
method defaultCompareFunction (line 17) | static defaultCompareFunction(a, b) {
method equal (line 31) | equal(a, b) {
method lessThan (line 41) | lessThan(a, b) {
method greaterThan (line 51) | greaterThan(a, b) {
method lessThanOrEqual (line 61) | lessThanOrEqual(a, b) {
method greaterThanOrEqual (line 71) | greaterThanOrEqual(a, b) {
method reverse (line 78) | reverse() {
Condensed preview — 627 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,811K chars).
[
{
"path": ".babelrc",
"chars": 39,
"preview": "{\n \"presets\": [\"@babel/preset-env\"]\n}\n"
},
{
"path": ".editorconfig",
"chars": 201,
"preview": "# @see: https://editorconfig.org/\nroot = true\n\n[*]\nend_of_line = lf\ninsert_final_newline = true\ncharset = utf-8\nindent_s"
},
{
"path": ".eslintrc",
"chars": 396,
"preview": "{\n \"root\": true,\n \"extends\": \"airbnb\",\n \"plugins\": [\"jest\"],\n \"env\": {\n \"jest/globals\": true\n },\n \"rules\": {\n "
},
{
"path": ".github/workflows/CI.yml",
"chars": 671,
"preview": "name: CI\n\non:\n push:\n branches: [ master ]\n pull_request:\n branches: [ master ]\n\njobs:\n test:\n runs-on: ubun"
},
{
"path": ".gitignore",
"chars": 46,
"preview": "node_modules\n.idea\ncoverage\n.vscode\n.DS_Store\n"
},
{
"path": ".husky/pre-commit",
"chars": 13,
"preview": "npm run lint\n"
},
{
"path": ".npmrc",
"chars": 19,
"preview": "engine-strict=true\n"
},
{
"path": ".nvmrc",
"chars": 4,
"preview": "v22\n"
},
{
"path": "BACKERS.md",
"chars": 748,
"preview": "# Project Backers\n\n> You may support this project via ❤️️ [GitHub](https://github.com/sponsors/trekhleb) or ❤️️ [Patreon"
},
{
"path": "CODE_OF_CONDUCT.md",
"chars": 2558,
"preview": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nIn the interest of fostering an open and welcoming environment, w"
},
{
"path": "CONTRIBUTING.md",
"chars": 1117,
"preview": "## Contributing\n\n**General Rules**\n\n- As much as possible, try to follow the existing format of markdown and code.\n- Don"
},
{
"path": "LICENSE",
"chars": 1083,
"preview": "The MIT License (MIT)\n\nCopyright (c) 2018 Oleksii Trekhleb\n\nPermission is hereby granted, free of charge, to any person "
},
{
"path": "README.ar-AR.md",
"chars": 20324,
"preview": "# جافا سكريبت خوارزميات وهياكل البيانات\n\n["
},
{
"path": "README.id-ID.md",
"chars": 24342,
"preview": "# Algoritme dan Struktur Data Javascript\n\n[](https://gith"
},
{
"path": "README.ko-KR.md",
"chars": 15350,
"preview": "# JavaScript 알고리즘 및 자료 구조\n\n[](https://git"
},
{
"path": "README.md",
"chars": 25357,
"preview": "# JavaScript Algorithms and Data Structures\n\n> 🇺🇦 UKRAINE [IS BEING ATTACKED](https://war.ukraine.ua/) BY RUSSIAN ARMY. "
},
{
"path": "README.pl-PL.md",
"chars": 20052,
"preview": "# JavaScript Algorytmy i Struktury Danych\n\n[](https://github.c"
},
{
"path": "README.zh-TW.md",
"chars": 10959,
"preview": "# JavaScript 演算法與資料結構\n\n[](https://github."
},
{
"path": "jest.config.js",
"chars": 1292,
"preview": "module.exports = {\n // The bail config option can be used here to have Jest stop running tests after\n // the first fai"
},
{
"path": "package.json",
"chars": 1408,
"preview": "{\n \"name\": \"javascript-algorithms-and-data-structures\",\n \"version\": \"0.0.4\",\n \"description\": \"Algorithms and data-str"
},
{
"path": "src/algorithms/cryptography/caesar-cipher/README.md",
"chars": 1565,
"preview": "# Caesar Cipher Algorithm\n\n_Read this in other languages:_\n[_Русский_](README.ru-RU.md)\n\nIn cryptography, a **Caesar cip"
},
{
"path": "src/algorithms/cryptography/caesar-cipher/README.ru-RU.md",
"chars": 1536,
"preview": "# Алгоритм шифра Цезаря\n\nВ криптографии **шифр Цезаря**, также известный как **шифр сдвига**, **код Цезаря** или **сдвиг"
},
{
"path": "src/algorithms/cryptography/caesar-cipher/__test__/caesarCipher.test.js",
"chars": 1458,
"preview": "import { caesarCipherEncrypt, caesarCipherDecrypt } from '../caesarCipher';\n\ndescribe('caesarCipher', () => {\n it('shou"
},
{
"path": "src/algorithms/cryptography/caesar-cipher/caesarCipher.js",
"chars": 1808,
"preview": "// Create alphabet array: ['a', 'b', 'c', ..., 'z'].\nconst englishAlphabet = 'abcdefghijklmnopqrstuvwxyz'.split('');\n\n/*"
},
{
"path": "src/algorithms/cryptography/hill-cipher/README.md",
"chars": 4052,
"preview": "# Hill Cipher\n\nThe **Hill cipher** is a [polygraphic substitution](https://en.wikipedia.org/wiki/Polygraphic_substitutio"
},
{
"path": "src/algorithms/cryptography/hill-cipher/_test_/hillCipher.test.js",
"chars": 1767,
"preview": "import { hillCipherEncrypt, hillCipherDecrypt } from '../hillCipher';\n\ndescribe('hillCipher', () => {\n it('should throw"
},
{
"path": "src/algorithms/cryptography/hill-cipher/hillCipher.js",
"chars": 2826,
"preview": "import * as mtrx from '../../math/matrix/Matrix';\n\n// The code of an 'A' character (equals to 65).\nconst alphabetCodeShi"
},
{
"path": "src/algorithms/cryptography/polynomial-hash/PolynomialHash.js",
"chars": 2270,
"preview": "const DEFAULT_BASE = 37;\nconst DEFAULT_MODULUS = 101;\n\nexport default class PolynomialHash {\n /**\n * @param {number} "
},
{
"path": "src/algorithms/cryptography/polynomial-hash/README.md",
"chars": 4763,
"preview": "# Polynomial Rolling Hash\n\n## Hash Function\n\n**Hash functions** are used to map large data sets of elements of an arbitr"
},
{
"path": "src/algorithms/cryptography/polynomial-hash/SimplePolynomialHash.js",
"chars": 1861,
"preview": "const DEFAULT_BASE = 17;\n\nexport default class SimplePolynomialHash {\n /**\n * @param {number} [base] - Base number th"
},
{
"path": "src/algorithms/cryptography/polynomial-hash/__test__/PolynomialHash.test.js",
"chars": 2494,
"preview": "import PolynomialHash from '../PolynomialHash';\n\ndescribe('PolynomialHash', () => {\n it('should calculate new hash base"
},
{
"path": "src/algorithms/cryptography/polynomial-hash/__test__/SimplePolynomialHash.test.js",
"chars": 2159,
"preview": "import SimplePolynomialHash from '../SimplePolynomialHash';\n\ndescribe('PolynomialHash', () => {\n it('should calculate n"
},
{
"path": "src/algorithms/cryptography/rail-fence-cipher/README.md",
"chars": 1992,
"preview": "# Rail Fence Cipher\n\nThe **rail fence cipher** (also called a **zigzag cipher**) is a [transposition cipher](https://en."
},
{
"path": "src/algorithms/cryptography/rail-fence-cipher/__test__/railFenceCipher.test.js",
"chars": 1367,
"preview": "import { encodeRailFenceCipher, decodeRailFenceCipher } from '../railFenceCipher';\n\ndescribe('railFenceCipher', () => {\n"
},
{
"path": "src/algorithms/cryptography/rail-fence-cipher/railFenceCipher.js",
"chars": 5852,
"preview": "/**\n * @typedef {string[]} Rail\n * @typedef {Rail[]} Fence\n * @typedef {number} Direction\n */\n\n/**\n * @constant DIRECTIO"
},
{
"path": "src/algorithms/graph/articulation-points/README.md",
"chars": 1035,
"preview": "# Articulation Points (or Cut Vertices)\n\nA vertex in an undirected connected graph is an articulation point\n(or cut vert"
},
{
"path": "src/algorithms/graph/articulation-points/__test__/articulationPoints.test.js",
"chars": 8081,
"preview": "import GraphVertex from '../../../../data-structures/graph/GraphVertex';\nimport GraphEdge from '../../../../data-structu"
},
{
"path": "src/algorithms/graph/articulation-points/articulationPoints.js",
"chars": 4130,
"preview": "import depthFirstSearch from '../depth-first-search/depthFirstSearch';\n\n/**\n * Helper class for visited vertex metadata."
},
{
"path": "src/algorithms/graph/bellman-ford/README.md",
"chars": 797,
"preview": "# Bellman–Ford Algorithm\n\nThe Bellman–Ford algorithm is an algorithm that computes shortest \npaths from a single source "
},
{
"path": "src/algorithms/graph/bellman-ford/__test__/bellmanFord.test.js",
"chars": 3877,
"preview": "import GraphVertex from '../../../../data-structures/graph/GraphVertex';\nimport GraphEdge from '../../../../data-structu"
},
{
"path": "src/algorithms/graph/bellman-ford/bellmanFord.js",
"chars": 1538,
"preview": "/**\n * @param {Graph} graph\n * @param {GraphVertex} startVertex\n * @return {{distances, previousVertices}}\n */\nexport de"
},
{
"path": "src/algorithms/graph/breadth-first-search/README.md",
"chars": 799,
"preview": "# Breadth-First Search (BFS)\n\nBreadth-first search (BFS) is an algorithm for traversing, \nsearching tree, or graph data "
},
{
"path": "src/algorithms/graph/breadth-first-search/__test__/breadthFirstSearch.test.js",
"chars": 6958,
"preview": "import Graph from '../../../../data-structures/graph/Graph';\nimport GraphVertex from '../../../../data-structures/graph/"
},
{
"path": "src/algorithms/graph/breadth-first-search/breadthFirstSearch.js",
"chars": 2225,
"preview": "import Queue from '../../../data-structures/queue/Queue';\n\n/**\n * @typedef {Object} Callbacks\n *\n * @property {function("
},
{
"path": "src/algorithms/graph/bridges/README.md",
"chars": 1179,
"preview": "# Bridges in Graph\n\nIn graph theory, a **bridge**, **isthmus**, **cut-edge**, or **cut arc** is an edge \nof a graph whos"
},
{
"path": "src/algorithms/graph/bridges/__test__/graphBridges.test.js",
"chars": 6602,
"preview": "import GraphVertex from '../../../../data-structures/graph/GraphVertex';\nimport GraphEdge from '../../../../data-structu"
},
{
"path": "src/algorithms/graph/bridges/graphBridges.js",
"chars": 3377,
"preview": "import depthFirstSearch from '../depth-first-search/depthFirstSearch';\n\n/**\n * Helper class for visited vertex metadata."
},
{
"path": "src/algorithms/graph/depth-first-search/README.md",
"chars": 759,
"preview": "# Depth-First Search (DFS)\n\nDepth-first search (DFS) is an algorithm for traversing or \nsearching tree or graph data str"
},
{
"path": "src/algorithms/graph/depth-first-search/__test__/depthFirstSearch.test.js",
"chars": 6652,
"preview": "import Graph from '../../../../data-structures/graph/Graph';\nimport GraphVertex from '../../../../data-structures/graph/"
},
{
"path": "src/algorithms/graph/depth-first-search/depthFirstSearch.js",
"chars": 2059,
"preview": "/**\n * @typedef {Object} Callbacks\n *\n * @property {function(vertices: Object): boolean} [allowTraversal] -\n * Determin"
},
{
"path": "src/algorithms/graph/detect-cycle/README.md",
"chars": 2791,
"preview": "# Detect Cycle in Graphs\n\nIn graph theory, a **cycle** is a path of edges and vertices \nwherein a vertex is reachable fr"
},
{
"path": "src/algorithms/graph/detect-cycle/__test__/detectDirectedCycle.test.js",
"chars": 1351,
"preview": "import GraphVertex from '../../../../data-structures/graph/GraphVertex';\nimport GraphEdge from '../../../../data-structu"
},
{
"path": "src/algorithms/graph/detect-cycle/__test__/detectUndirectedCycle.test.js",
"chars": 1302,
"preview": "import GraphVertex from '../../../../data-structures/graph/GraphVertex';\nimport GraphEdge from '../../../../data-structu"
},
{
"path": "src/algorithms/graph/detect-cycle/__test__/detectUndirectedCycleUsingDisjointSet.test.js",
"chars": 1305,
"preview": "import GraphVertex from '../../../../data-structures/graph/GraphVertex';\nimport GraphEdge from '../../../../data-structu"
},
{
"path": "src/algorithms/graph/detect-cycle/detectDirectedCycle.js",
"chars": 3307,
"preview": "import depthFirstSearch from '../depth-first-search/depthFirstSearch';\n\n/**\n * Detect cycle in directed graph using Dept"
},
{
"path": "src/algorithms/graph/detect-cycle/detectUndirectedCycle.js",
"chars": 1922,
"preview": "import depthFirstSearch from '../depth-first-search/depthFirstSearch';\n\n/**\n * Detect cycle in undirected graph using De"
},
{
"path": "src/algorithms/graph/detect-cycle/detectUndirectedCycleUsingDisjointSet.js",
"chars": 1185,
"preview": "import DisjointSet from '../../../data-structures/disjoint-set/DisjointSet';\n\n/**\n * Detect cycle in undirected graph us"
},
{
"path": "src/algorithms/graph/dijkstra/README.de-DE.md",
"chars": 7143,
"preview": "# Dijkstra-Algorithmus\n\n_Lies dies in anderen Sprachen:_\n[_English_](README.md),\n[_한국어_](README.ko-KR.md),\n[_日本語_](READM"
},
{
"path": "src/algorithms/graph/dijkstra/README.es-ES.md",
"chars": 7056,
"preview": "# Algoritmo de Dijkstra\n\n_Lee esto en otros idiomas:_\n[_English_](README.md),\n[_한국어_](README.ko-KR.md),\n[_日本語_](README.j"
},
{
"path": "src/algorithms/graph/dijkstra/README.fr-FR.md",
"chars": 7291,
"preview": "# Algorithme de Dijkstra\n\n_Lire ceci dans d’autres langues :_\n[_English_](README.md),\n[_한국어_](README.ko-KR.md),\n[_日本語_]("
},
{
"path": "src/algorithms/graph/dijkstra/README.he-IL.md",
"chars": 5285,
"preview": "# אלגוריתם דייקסטרה (Dijkstra's Algorithm)\n\n_קרא בשפות אחרות:_\n[_English_](README.md),\n[_한국어_](README.ko-KR.md),\n[_日本語_]"
},
{
"path": "src/algorithms/graph/dijkstra/README.ja-JP.md",
"chars": 3868,
"preview": "# ダイクストラ法 (Dijkstra's Algorithm)\n\n_他の言語で読む:_\n[_English_](README.md),\n[_한국어_](README.ko-KR.md),\n[_日本語_](README.ja-JP.md),"
},
{
"path": "src/algorithms/graph/dijkstra/README.ko-KR.md",
"chars": 4063,
"preview": "# 다익스트라 알고리즘 (Dijkstra's Algorithm)\n\n_다른 언어로 읽기:_\n[_English_](README.md),\n[_한국어_](README.ko-KR.md),\n[_日本語_](README.ja-JP"
},
{
"path": "src/algorithms/graph/dijkstra/README.md",
"chars": 7138,
"preview": "# Dijkstra's Algorithm\n\n_Read this in other languages:_\n[_한국어_](README.ko-KR.md),\n[_日本語_](README.ja-JP.md),\n[_简体中文_](REA"
},
{
"path": "src/algorithms/graph/dijkstra/README.uk-UA.md",
"chars": 5952,
"preview": "# Алгоритм Дейкстри\n\n_Читайте іншими мовами:_\n[_English_](README.md),\n[_한국어_](README.ko-KR.md),\n[_日本語_](README.ja-JP.md)"
},
{
"path": "src/algorithms/graph/dijkstra/README.zh-CN.md",
"chars": 3428,
"preview": "# Dijkstra 算法\n\n_阅读其他语言版本:_\n[_English_](README.md),\n[_한국어_](README.ko-KR.md),\n[_日本語_](README.ja-JP.md),\n[_简体中文_](README.z"
},
{
"path": "src/algorithms/graph/dijkstra/README.zh-TW.md",
"chars": 3468,
"preview": "# Dijkstra 演算法\n\n_以其他語言閱讀:_\n[_English_](README.md),\n[_한국어_](README.ko-KR.md),\n[_日本語_](README.ja-JP.md),\n[_简体中文_](README.z"
},
{
"path": "src/algorithms/graph/dijkstra/__test__/dijkstra.test.js",
"chars": 3862,
"preview": "import GraphVertex from '../../../../data-structures/graph/GraphVertex';\nimport GraphEdge from '../../../../data-structu"
},
{
"path": "src/algorithms/graph/dijkstra/dijkstra.js",
"chars": 2974,
"preview": "import PriorityQueue from '../../../data-structures/priority-queue/PriorityQueue';\n\n/**\n * @typedef {Object} ShortestPat"
},
{
"path": "src/algorithms/graph/eulerian-path/README.md",
"chars": 1568,
"preview": "# Eulerian Path\n\nIn graph theory, an **Eulerian trail** (or **Eulerian path**) is a \ntrail in a finite graph which visit"
},
{
"path": "src/algorithms/graph/eulerian-path/__test__/eulerianPath.test.js",
"chars": 5116,
"preview": "import GraphVertex from '../../../../data-structures/graph/GraphVertex';\nimport GraphEdge from '../../../../data-structu"
},
{
"path": "src/algorithms/graph/eulerian-path/eulerianPath.js",
"chars": 3494,
"preview": "import graphBridges from '../bridges/graphBridges';\n\n/**\n * Fleury's algorithm of finding Eulerian Path (visit all graph"
},
{
"path": "src/algorithms/graph/floyd-warshall/README.md",
"chars": 3398,
"preview": "# Floyd–Warshall Algorithm\n\nIn computer science, the **Floyd–Warshall algorithm** is an algorithm for finding\nshortest p"
},
{
"path": "src/algorithms/graph/floyd-warshall/__test__/floydWarshall.test.js",
"chars": 8456,
"preview": "import GraphVertex from '../../../../data-structures/graph/GraphVertex';\nimport GraphEdge from '../../../../data-structu"
},
{
"path": "src/algorithms/graph/floyd-warshall/floydWarshall.js",
"chars": 3000,
"preview": "/**\n * @param {Graph} graph\n * @return {{distances: number[][], nextVertices: GraphVertex[][]}}\n */\nexport default funct"
},
{
"path": "src/algorithms/graph/hamiltonian-cycle/README.md",
"chars": 1753,
"preview": "# Hamiltonian Path\n\n**Hamiltonian path** (or **traceable path**) is a path in an \nundirected or directed graph that visi"
},
{
"path": "src/algorithms/graph/hamiltonian-cycle/__test__/hamiltonianCycle.test.js",
"chars": 3632,
"preview": "import GraphVertex from '../../../../data-structures/graph/GraphVertex';\nimport GraphEdge from '../../../../data-structu"
},
{
"path": "src/algorithms/graph/hamiltonian-cycle/hamiltonianCycle.js",
"chars": 4278,
"preview": "import GraphVertex from '../../../data-structures/graph/GraphVertex';\n\n/**\n * @param {number[][]} adjacencyMatrix\n * @pa"
},
{
"path": "src/algorithms/graph/kruskal/README.ko-KR.md",
"chars": 1589,
"preview": "# 크루스칼 알고리즘\n\n크루스칼 알고리즘은 두 트리를 연결하는 최소 간선 가중치를 찾는 최소 신장 트리 알고리즘입니다.\n각 단계에서 비용을 더하는 연결된 가중 그래프에 대한 최소 신장 트리를 찾기 때문에 그래프 이론"
},
{
"path": "src/algorithms/graph/kruskal/README.md",
"chars": 2484,
"preview": "# Kruskal's Algorithm\n\n_Read this in other languages:_\n[_한국어_](README.ko-KR.md)\n\nKruskal's algorithm is a minimum-spanni"
},
{
"path": "src/algorithms/graph/kruskal/__test__/kruskal.test.js",
"chars": 3136,
"preview": "import GraphVertex from '../../../../data-structures/graph/GraphVertex';\nimport GraphEdge from '../../../../data-structu"
},
{
"path": "src/algorithms/graph/kruskal/kruskal.js",
"chars": 2148,
"preview": "import Graph from '../../../data-structures/graph/Graph';\nimport QuickSort from '../../sorting/quick-sort/QuickSort';\nim"
},
{
"path": "src/algorithms/graph/prim/README.md",
"chars": 2271,
"preview": "# Prim's Algorithm\n\nIn computer science, **Prim's algorithm** is a greedy algorithm that \nfinds a minimum spanning tree "
},
{
"path": "src/algorithms/graph/prim/__test__/prim.test.js",
"chars": 3118,
"preview": "import GraphVertex from '../../../../data-structures/graph/GraphVertex';\nimport GraphEdge from '../../../../data-structu"
},
{
"path": "src/algorithms/graph/prim/prim.js",
"chars": 2565,
"preview": "import Graph from '../../../data-structures/graph/Graph';\nimport PriorityQueue from '../../../data-structures/priority-q"
},
{
"path": "src/algorithms/graph/strongly-connected-components/README.md",
"chars": 682,
"preview": "# Strongly Connected Component\n\nA directed graph is called **strongly connected** if there is a path \nin each direction "
},
{
"path": "src/algorithms/graph/strongly-connected-components/__test__/stronglyConnectedComponents.test.js",
"chars": 3703,
"preview": "import GraphVertex from '../../../../data-structures/graph/GraphVertex';\nimport GraphEdge from '../../../../data-structu"
},
{
"path": "src/algorithms/graph/strongly-connected-components/stronglyConnectedComponents.js",
"chars": 4667,
"preview": "import Stack from '../../../data-structures/stack/Stack';\nimport depthFirstSearch from '../depth-first-search/depthFirst"
},
{
"path": "src/algorithms/graph/topological-sorting/README.md",
"chars": 2720,
"preview": "# Topological Sorting\n\nIn the field of computer science, a topological sort or \ntopological ordering of a directed graph"
},
{
"path": "src/algorithms/graph/topological-sorting/__test__/topologicalSort.test.js",
"chars": 1671,
"preview": "import GraphVertex from '../../../../data-structures/graph/GraphVertex';\nimport GraphEdge from '../../../../data-structu"
},
{
"path": "src/algorithms/graph/topological-sorting/topologicalSort.js",
"chars": 1487,
"preview": "import Stack from '../../../data-structures/stack/Stack';\nimport depthFirstSearch from '../depth-first-search/depthFirst"
},
{
"path": "src/algorithms/graph/travelling-salesman/README.md",
"chars": 1226,
"preview": "# Travelling Salesman Problem\n\nThe travelling salesman problem (TSP) asks the following question: \n\"Given a list of citi"
},
{
"path": "src/algorithms/graph/travelling-salesman/__test__/bfTravellingSalesman.test.js",
"chars": 1876,
"preview": "import GraphVertex from '../../../../data-structures/graph/GraphVertex';\nimport GraphEdge from '../../../../data-structu"
},
{
"path": "src/algorithms/graph/travelling-salesman/bfTravellingSalesman.js",
"chars": 3337,
"preview": "/**\n * Get all possible paths\n * @param {GraphVertex} startVertex\n * @param {GraphVertex[][]} [paths]\n * @param {GraphVe"
},
{
"path": "src/algorithms/image-processing/seam-carving/README.md",
"chars": 31945,
"preview": "# Content-aware image resizing in JavaScript\n\n.\n * @typ"
},
{
"path": "src/algorithms/image-processing/utils/imageData.js",
"chars": 1248,
"preview": "/**\n * @typedef {ArrayLike<number> | Uint8ClampedArray} PixelColor\n */\n\n/**\n * @typedef {Object} PixelCoordinate\n * @pro"
},
{
"path": "src/algorithms/linked-list/reverse-traversal/README.md",
"chars": 517,
"preview": "# Reversed Linked List Traversal\n\n_Read this in other languages:_\n[_中文_](README.zh-CN.md),\n[_Português_](README.pt-BR.md"
},
{
"path": "src/algorithms/linked-list/reverse-traversal/README.pt-BR.md",
"chars": 522,
"preview": "# Travessia de Lista Encadeada Reversa\n\n_Leia isso em outros idiomas:_\n[_中文_](README.zh-CN.md),\n[_English_](README.md)\n\n"
},
{
"path": "src/algorithms/linked-list/reverse-traversal/README.zh-CN.md",
"chars": 254,
"preview": "# 链表倒序遍历\n\n我们的任务是倒序遍历给定的链表\n\n比如下面的链表\n\n\n\n遍历的"
},
{
"path": "src/algorithms/linked-list/reverse-traversal/__test__/reverseTraversal.test.js",
"chars": 1010,
"preview": "import LinkedList from '../../../../data-structures/linked-list/LinkedList';\nimport reverseTraversal from '../reverseTra"
},
{
"path": "src/algorithms/linked-list/reverse-traversal/reverseTraversal.js",
"chars": 531,
"preview": "/**\n * Traversal callback function.\n * @callback traversalCallback\n * @param {*} nodeValue\n */\n\n/**\n * @param {LinkedLis"
},
{
"path": "src/algorithms/linked-list/traversal/README.md",
"chars": 555,
"preview": "# Linked List Traversal\n\n_Read this in other languages:_\n[_Русский_](README.ru-RU.md),\n[_中文_](README.zh-CN.md),\n[_Portug"
},
{
"path": "src/algorithms/linked-list/traversal/README.pt-BR.md",
"chars": 561,
"preview": "# Travessia de Lista Encadeada\n\n_Leia isso em outros idiomas:_\n[_Русский_](README.ru-RU.md),\n[_中文_](README.zh-CN.md),\n[_"
},
{
"path": "src/algorithms/linked-list/traversal/README.ru-RU.md",
"chars": 510,
"preview": "# Обход связного списка\n\nЗадача состоит в том, чтобы обойти связный список в прямом порядке.\n\nНапример, для следующего с"
},
{
"path": "src/algorithms/linked-list/traversal/README.zh-CN.md",
"chars": 269,
"preview": "# 链表遍历\n\n我们的任务是顺序遍历给定的链表\n\n比如下面的链表\n\n.\n\n#### Vérifier un bit (_get_)\n\nCette métho"
},
{
"path": "src/algorithms/math/bits/README.md",
"chars": 8194,
"preview": "# Bit Manipulation\n\n_Read this in other languages:_\n[français](README.fr-FR.md),\n[简体中文](README.zh-CN.md).\n\n#### Get Bit\n"
},
{
"path": "src/algorithms/math/bits/README.zh-CN.md",
"chars": 5049,
"preview": "# 位运算\n\n_Read this in other languages:_\n[français](README.fr-FR.md),\n[english](README.md)\n\n#### Get Bit\n\n该方法向右移动目标位到最右边,即"
},
{
"path": "src/algorithms/math/bits/__test__/bitLength.test.js",
"chars": 473,
"preview": "import bitLength from '../bitLength';\n\ndescribe('bitLength', () => {\n it('should calculate number of bits that the numb"
},
{
"path": "src/algorithms/math/bits/__test__/bitsDiff.test.js",
"chars": 401,
"preview": "import bitsDiff from '../bitsDiff';\n\ndescribe('bitsDiff', () => {\n it('should calculate bits difference between two num"
},
{
"path": "src/algorithms/math/bits/__test__/clearBit.test.js",
"chars": 388,
"preview": "import clearBit from '../clearBit';\n\ndescribe('clearBit', () => {\n it('should clear bit at specific position', () => {\n"
},
{
"path": "src/algorithms/math/bits/__test__/countSetBits.test.js",
"chars": 686,
"preview": "import countSetBits from '../countSetBits';\n\ndescribe('countSetBits', () => {\n it('should return number of set bits', ("
},
{
"path": "src/algorithms/math/bits/__test__/divideByTwo.test.js",
"chars": 376,
"preview": "import divideByTwo from '../divideByTwo';\n\ndescribe('divideByTwo', () => {\n it('should divide numbers by two using bitw"
},
{
"path": "src/algorithms/math/bits/__test__/fullAdder.test.js",
"chars": 581,
"preview": "import fullAdder from '../fullAdder';\n\ndescribe('fullAdder', () => {\n it('should add up two numbers', () => {\n expec"
},
{
"path": "src/algorithms/math/bits/__test__/getBit.test.js",
"chars": 542,
"preview": "import getBit from '../getBit';\n\ndescribe('getBit', () => {\n it('should get bit at specific position', () => {\n // 1"
},
{
"path": "src/algorithms/math/bits/__test__/isEven.test.js",
"chars": 582,
"preview": "import isEven from '../isEven';\n\ndescribe('isEven', () => {\n it('should detect if a number is even', () => {\n expect"
},
{
"path": "src/algorithms/math/bits/__test__/isPositive.test.js",
"chars": 628,
"preview": "import isPositive from '../isPositive';\n\ndescribe('isPositive', () => {\n it('should detect if a number is positive', ()"
},
{
"path": "src/algorithms/math/bits/__test__/isPowerOfTwo.test.js",
"chars": 722,
"preview": "import isPowerOfTwo from '../isPowerOfTwo';\n\ndescribe('isPowerOfTwo', () => {\n it('should detect if the number is power"
},
{
"path": "src/algorithms/math/bits/__test__/multiply.test.js",
"chars": 571,
"preview": "import multiply from '../multiply';\n\ndescribe('multiply', () => {\n it('should multiply two numbers', () => {\n expect"
},
{
"path": "src/algorithms/math/bits/__test__/multiplyByTwo.test.js",
"chars": 399,
"preview": "import multiplyByTwo from '../multiplyByTwo';\n\ndescribe('multiplyByTwo', () => {\n it('should multiply numbers by two us"
},
{
"path": "src/algorithms/math/bits/__test__/multiplyUnsigned.test.js",
"chars": 567,
"preview": "import multiplyUnsigned from '../multiplyUnsigned';\n\ndescribe('multiplyUnsigned', () => {\n it('should multiply two unsi"
},
{
"path": "src/algorithms/math/bits/__test__/setBit.test.js",
"chars": 370,
"preview": "import setBit from '../setBit';\n\ndescribe('setBit', () => {\n it('should set bit at specific position', () => {\n // 1"
},
{
"path": "src/algorithms/math/bits/__test__/switchSign.test.js",
"chars": 425,
"preview": "import switchSign from '../switchSign';\n\ndescribe('switchSign', () => {\n it('should switch the sign of the number using"
},
{
"path": "src/algorithms/math/bits/__test__/updateBit.test.js",
"chars": 583,
"preview": "import updateBit from '../updateBit';\n\ndescribe('updateBit', () => {\n it('should update bit at specific position', () ="
},
{
"path": "src/algorithms/math/bits/bitLength.js",
"chars": 295,
"preview": "/**\n * Return the number of bits used in the binary representation of the number.\n *\n * @param {number} number\n * @retur"
},
{
"path": "src/algorithms/math/bits/bitsDiff.js",
"chars": 321,
"preview": "import countSetBits from './countSetBits';\n\n/**\n * Counts the number of bits that need to be change in order\n * to conve"
},
{
"path": "src/algorithms/math/bits/clearBit.js",
"chars": 218,
"preview": "/**\n * @param {number} number\n * @param {number} bitPosition - zero based.\n * @return {number}\n */\nexport default functi"
},
{
"path": "src/algorithms/math/bits/countSetBits.js",
"chars": 396,
"preview": "/**\n * @param {number} originalNumber\n * @return {number}\n */\nexport default function countSetBits(originalNumber) {\n l"
},
{
"path": "src/algorithms/math/bits/divideByTwo.js",
"chars": 124,
"preview": "/**\n * @param {number} number\n * @return {number}\n */\nexport default function divideByTwo(number) {\n return number >> 1"
},
{
"path": "src/algorithms/math/bits/fullAdder.js",
"chars": 2150,
"preview": "import getBit from './getBit';\n\n/**\n * Add two numbers using only binary operators.\n *\n * This is an implementation of f"
},
{
"path": "src/algorithms/math/bits/getBit.js",
"chars": 193,
"preview": "/**\n * @param {number} number\n * @param {number} bitPosition - zero based.\n * @return {number}\n */\nexport default functi"
},
{
"path": "src/algorithms/math/bits/isEven.js",
"chars": 127,
"preview": "/**\n * @param {number} number\n * @return {boolean}\n */\nexport default function isEven(number) {\n return (number & 1) =="
},
{
"path": "src/algorithms/math/bits/isPositive.js",
"chars": 349,
"preview": "/**\n * @param {number} number - 32-bit integer.\n * @return {boolean}\n */\nexport default function isPositive(number) {\n "
},
{
"path": "src/algorithms/math/bits/isPowerOfTwo.js",
"chars": 139,
"preview": "/**\n * @param {number} number\n * @return bool\n */\nexport default function isPowerOfTwo(number) {\n return (number & (num"
},
{
"path": "src/algorithms/math/bits/multiply.js",
"chars": 1299,
"preview": "import multiplyByTwo from './multiplyByTwo';\nimport divideByTwo from './divideByTwo';\nimport isEven from './isEven';\nimp"
},
{
"path": "src/algorithms/math/bits/multiplyByTwo.js",
"chars": 126,
"preview": "/**\n * @param {number} number\n * @return {number}\n */\nexport default function multiplyByTwo(number) {\n return number <<"
},
{
"path": "src/algorithms/math/bits/multiplyUnsigned.js",
"chars": 1156,
"preview": "/**\n * Multiply to unsigned numbers using bitwise operator.\n *\n * The main idea of bitwise multiplication is that every "
},
{
"path": "src/algorithms/math/bits/setBit.js",
"chars": 193,
"preview": "/**\n * @param {number} number\n * @param {number} bitPosition - zero based.\n * @return {number}\n */\nexport default functi"
},
{
"path": "src/algorithms/math/bits/switchSign.js",
"chars": 190,
"preview": "/**\n * Switch the sign of the number using \"Twos Complement\" approach.\n * @param {number} number\n * @return {number}\n */"
},
{
"path": "src/algorithms/math/bits/updateBit.js",
"chars": 473,
"preview": "/**\n * @param {number} number\n * @param {number} bitPosition - zero based.\n * @param {number} bitValue - 0 or 1.\n * @ret"
},
{
"path": "src/algorithms/math/complex-number/ComplexNumber.js",
"chars": 4034,
"preview": "import radianToDegree from '../radian/radianToDegree';\n\nexport default class ComplexNumber {\n /**\n * z = re + im * i\n"
},
{
"path": "src/algorithms/math/complex-number/README.fr-FR.md",
"chars": 7655,
"preview": "# Nombre complexe\n\n_Read this in other languages:_\n[english](README.md).\n\nUn **nombre complexe** est un nombre qui peut "
},
{
"path": "src/algorithms/math/complex-number/README.md",
"chars": 6921,
"preview": "# Complex Number\n\n_Read this in other languages:_\n[français](README.fr-FR.md).\n\nA **complex number** is a number that ca"
},
{
"path": "src/algorithms/math/complex-number/__test__/ComplexNumber.test.js",
"chars": 7076,
"preview": "import ComplexNumber from '../ComplexNumber';\n\ndescribe('ComplexNumber', () => {\n it('should create complex numbers', ("
},
{
"path": "src/algorithms/math/euclidean-algorithm/README.fr-FR.md",
"chars": 3123,
"preview": "# Algorithme d'Euclide\n\n_Read this in other languages:_\n[english](README.md).\n\nEn mathématiques, l'algorithme d'Euclide "
},
{
"path": "src/algorithms/math/euclidean-algorithm/README.md",
"chars": 2778,
"preview": "# Euclidean algorithm\n\n_Read this in other languages:_\n[français](README.fr-FR.md).\n\nIn mathematics, the Euclidean algor"
},
{
"path": "src/algorithms/math/euclidean-algorithm/__test__/euclideanAlgorithm.test.js",
"chars": 1123,
"preview": "import euclideanAlgorithm from '../euclideanAlgorithm';\n\ndescribe('euclideanAlgorithm', () => {\n it('should calculate G"
},
{
"path": "src/algorithms/math/euclidean-algorithm/__test__/euclideanAlgorithmIterative.test.js",
"chars": 1330,
"preview": "import euclideanAlgorithmIterative from '../euclideanAlgorithmIterative';\n\ndescribe('euclideanAlgorithmIterative', () =>"
},
{
"path": "src/algorithms/math/euclidean-algorithm/euclideanAlgorithm.js",
"chars": 515,
"preview": "/**\n * Recursive version of Euclidean Algorithm of finding greatest common divisor (GCD).\n * @param {number} originalA\n "
},
{
"path": "src/algorithms/math/euclidean-algorithm/euclideanAlgorithmIterative.js",
"chars": 698,
"preview": "/**\n * Iterative version of Euclidean Algorithm of finding greatest common divisor (GCD).\n * @param {number} originalA\n "
},
{
"path": "src/algorithms/math/euclidean-distance/README.md",
"chars": 1698,
"preview": "# Euclidean Distance\n\nIn mathematics, the **Euclidean distance** between two points in Euclidean space is the length of "
},
{
"path": "src/algorithms/math/euclidean-distance/__tests__/euclideanDistance.test.js",
"chars": 973,
"preview": "import euclideanDistance from '../euclideanDistance';\n\ndescribe('euclideanDistance', () => {\n it('should calculate eucl"
},
{
"path": "src/algorithms/math/euclidean-distance/euclideanDistance.js",
"chars": 603,
"preview": "/**\n * @typedef {import('../matrix/Matrix.js').Matrix} Matrix\n */\n\nimport * as mtrx from '../matrix/Matrix';\n\n/**\n * Cal"
},
{
"path": "src/algorithms/math/factorial/README.fr-FR.md",
"chars": 907,
"preview": "# Factorielle\n\n_Lisez ceci dans d'autres langues:_\n[english](README.md), [_简体中文_](README.zh-CN.md).\n\nEn mathématiques, l"
},
{
"path": "src/algorithms/math/factorial/README.ka-GE.md",
"chars": 960,
"preview": "# ფაქტორიალი\n\nმათემატიკაში `n` ნატურალური რიცხვის ფაქტორიალი\n(აღინიშნება `n!` სიმბოლოთი)\nარის ყველა ნატურალური რიცხვის ნ"
},
{
"path": "src/algorithms/math/factorial/README.md",
"chars": 966,
"preview": "# Factorial\n\n_Read this in other languages:_\n[_简体中文_](README.zh-CN.md), [_Français_](README.fr-FR.md), [_Türkçe_](README"
},
{
"path": "src/algorithms/math/factorial/README.tr-TR.md",
"chars": 1067,
"preview": "# Faktöriyel\n\n_Bunu diğer dillerde okuyun:_\n[_简体中文_](README.zh-CN.md), [français](README.fr-FR.md).\n\nFaktöriyel, matemat"
},
{
"path": "src/algorithms/math/factorial/README.uk-UA.md",
"chars": 982,
"preview": "# Факторіал\n\n_Прочитайте це іншими мовами:_\n[_English_](README.md), [_简体中文_](README.zh-CN.md), [_Français_](README.fr-FR"
},
{
"path": "src/algorithms/math/factorial/README.zh-CN.md",
"chars": 824,
"preview": "# 阶乘\n\n在数学上, 一个正整数 `n` 的阶乘 (写作 `n!`), 就是所有小于等于 `n` 的正整数的乘积. 比如:\n\n```\n5! = 5 * 4 * 3 * 2 * 1 = 120\n```\n\n| n | n! "
},
{
"path": "src/algorithms/math/factorial/__test__/factorial.test.js",
"chars": 305,
"preview": "import factorial from '../factorial';\n\ndescribe('factorial', () => {\n it('should calculate factorial', () => {\n expe"
},
{
"path": "src/algorithms/math/factorial/__test__/factorialRecursive.test.js",
"chars": 377,
"preview": "import factorialRecursive from '../factorialRecursive';\n\ndescribe('factorialRecursive', () => {\n it('should calculate f"
},
{
"path": "src/algorithms/math/factorial/factorial.js",
"chars": 199,
"preview": "/**\n * @param {number} number\n * @return {number}\n */\nexport default function factorial(number) {\n let result = 1;\n\n f"
},
{
"path": "src/algorithms/math/factorial/factorialRecursive.js",
"chars": 176,
"preview": "/**\n * @param {number} number\n * @return {number}\n */\nexport default function factorialRecursive(number) {\n return numb"
},
{
"path": "src/algorithms/math/fast-powering/README.fr-FR.md",
"chars": 2117,
"preview": "# Algorithme d'exponentiation rapide\n\n_Read this in other languages:_\n[english](README.md).\n\nEn algèbre, une **puissance"
},
{
"path": "src/algorithms/math/fast-powering/README.md",
"chars": 1803,
"preview": "# Fast Powering Algorithm\n\n_Read this in other languages:_\n[français](README.fr-FR.md).\n\n**The power of a number** says "
},
{
"path": "src/algorithms/math/fast-powering/__test__/fastPowering.test.js",
"chars": 929,
"preview": "import fastPowering from '../fastPowering';\n\ndescribe('fastPowering', () => {\n it('should compute power in log(n) time'"
},
{
"path": "src/algorithms/math/fast-powering/fastPowering.js",
"chars": 893,
"preview": "/**\n * Fast Powering Algorithm.\n * Recursive implementation to compute power.\n *\n * Complexity: log(n)\n *\n * @param {num"
},
{
"path": "src/algorithms/math/fibonacci/README.fr-FR.md",
"chars": 974,
"preview": "# Nombre de Fibonacci\n\n_Read this in other languages:_\n[english](README.md),\n[ქართული](README.ka-GE.md).\n\nEn mathématiqu"
},
{
"path": "src/algorithms/math/fibonacci/README.ka-GE.md",
"chars": 838,
"preview": "# ფიბონაჩის რიცხვი\n\nმათემატიკაში ფიბონაჩის მიმდევრობა წარმოადგენს მთელ რიცხვთა მიმდევრობას,\nრომელშიც ყოველი რიცხვი (პირვ"
},
{
"path": "src/algorithms/math/fibonacci/README.md",
"chars": 981,
"preview": "# Fibonacci Number\n\n_Read this in other languages:_\n[français](README.fr-FR.md),\n[简体中文](README.zh-CN.md),\n[ქართული](READ"
},
{
"path": "src/algorithms/math/fibonacci/README.zh-CN.md",
"chars": 600,
"preview": "# 斐波那契数\n\n_Read this in other languages:_\n[français](README.fr-FR.md),\n[english](README.md),\n[ქართული](README.ka-GE.md).\n"
},
{
"path": "src/algorithms/math/fibonacci/__test__/fibonacci.test.js",
"chars": 668,
"preview": "import fibonacci from '../fibonacci';\n\ndescribe('fibonacci', () => {\n it('should calculate fibonacci correctly', () => "
},
{
"path": "src/algorithms/math/fibonacci/__test__/fibonacciNth.test.js",
"chars": 885,
"preview": "import fibonacciNth from '../fibonacciNth';\n\ndescribe('fibonacciNth', () => {\n it('should calculate fibonacci correctly"
},
{
"path": "src/algorithms/math/fibonacci/__test__/fibonacciNthClosedForm.test.js",
"chars": 1041,
"preview": "import fibonacciNthClosedForm from '../fibonacciNthClosedForm';\n\ndescribe('fibonacciClosedForm', () => {\n it('should th"
},
{
"path": "src/algorithms/math/fibonacci/fibonacci.js",
"chars": 496,
"preview": "/**\n * Return a fibonacci sequence as an array.\n *\n * @param n\n * @return {number[]}\n */\nexport default function fibonac"
},
{
"path": "src/algorithms/math/fibonacci/fibonacciNth.js",
"chars": 466,
"preview": "/**\n * Calculate fibonacci number at specific position using Dynamic Programming approach.\n *\n * @param n\n * @return {nu"
}
]
// ... and 427 more files (download for full content)
About this extraction
This page contains the full source code of the trekhleb/javascript-algorithms GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 627 files (1.6 MB), approximately 527.9k tokens, and a symbol index with 600 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.