Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

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

Provide feedback

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

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit002b10a

Browse files
authored
docs: fix typos (TheAlgorithms#1283)
* docs: fix typos* fix
1 parent8cd86b1 commit002b10a

24 files changed

+47
-47
lines changed

‎Cache/Memoize.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const memoize = (func, cache = new Map()) => {
3030
/**
3131
* Arguments converted to JSON string for use as a key of Map - it's easy to detect collections like -> Object and Array
3232
* If the args input is -> [new Set([1, 2, 3, 4]), {name: 'myName', age: 23}]
33-
* Then theagrsKey generate to -> '[[1,2,3,4],{"name":"myName","age":23}]' which is JSON mean string
33+
* Then theargsKey generate to -> '[[1,2,3,4],{"name":"myName","age":23}]' which is JSON mean string
3434
* Now it's ready to be a perfect key for Map
3535
*/
3636
constargsKey=JSON.stringify(args,jsonReplacer)

‎Ciphers/test/AffineCipher.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('Test Affine Cipher', () => {
1919
expect(()=>encrypt('null',4,1)).toThrow()
2020
})
2121

22-
it('Test - 3 Pass string value to encrypt andecrypt function',()=>{
22+
it('Test - 3 Pass string value to encrypt anddecrypt function',()=>{
2323
expect(decrypt(encrypt('HELLO WORLD',5,8),5,8)).toBe('HELLO WORLD')
2424
expect(decrypt(encrypt('ABC DEF',3,5),3,5)).toBe('ABC DEF')
2525
expect(decrypt(encrypt('Brown fox jump over the fence',7,3),7,3)).toBe(

‎Ciphers/test/KeywordShiftedAlphabet.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import{encrypt,decrypt}from'../KeywordShiftedAlphabet'
22

3-
test('Hello world! ===dcrypt(encrypt(Hello world!))',()=>{
3+
test('Hello world! ===decrypt(encrypt(Hello world!))',()=>{
44
constword='Hello world!'
55
constresult=decrypt('keyword',encrypt('keyword',word))
66
expect(result).toMatch(word)
77
})
88

9-
test('The Algorithms ===dcrypt(encrypt(The Algorithms))',()=>{
9+
test('The Algorithms ===decrypt(encrypt(The Algorithms))',()=>{
1010
constword='The Algorithms'
1111
constresult=decrypt('keyword',encrypt('keyword',word))
1212
expect(result).toMatch(word)

‎Ciphers/test/VigenereCipher.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import{encrypt,decrypt}from'../VigenereCipher'
22

3-
test('Hello world! ===dcrypt(encrypt(Hello world!))',()=>{
3+
test('Hello world! ===decrypt(encrypt(Hello world!))',()=>{
44
constword='Hello world!'
55
constresult=decrypt(encrypt(word,'code'),'code')
66
expect(result).toMatch(word)
77
})
88

9-
test('The Algorithms ===dcrypt(encrypt(The Algorithms))',()=>{
9+
test('The Algorithms ===decrypt(encrypt(The Algorithms))',()=>{
1010
constword='The Algorithms'
1111
constresult=decrypt(encrypt(word,'code'),'code')
1212
expect(result).toMatch(word)

‎Conversions/BinaryToHex.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const hexLookup = (bin) => {
2929
}
3030
constbinaryToHex=(binaryString)=>{
3131
/*
32-
Function forconvertung Binary to Hex
32+
Function forconverting Binary to Hex
3333
3434
1. The conversion will start from Least Significant Digit (LSB) to the Most Significant Bit (MSB).
3535
2. We divide the bits into sections of 4-bits starting from LSB to MSB.

‎Conversions/RailwayTimeConversion.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ const RailwayTimeConversion = (timeString) => {
2121
returnnewTypeError('Argument is not a string.')
2222
}
2323
// split the string by ':' character.
24-
const[hour,minute,scondWithShift]=timeString.split(':')
24+
const[hour,minute,secondWithShift]=timeString.split(':')
2525
// split second and shift value.
26-
const[second,shift]=[scondWithShift.substr(0,2),scondWithShift.substr(2)]
26+
const[second,shift]=[secondWithShift.substr(0,2),secondWithShift.substr(2)]
2727
// convert shifted time to not-shift time(Railway time) by using the above explanation.
2828
if(shift==='PM'){
2929
if(parseInt(hour)===12){return`${hour}:${minute}:${second}`}else{return`${parseInt(hour)+12}:${minute}:${second}`}

‎Conversions/test/TemperatureConversion.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,19 @@ describe('Testing Conversion of Rankine to Kelvin', () => {
8080
expect(test1).toBe(6)
8181
})
8282
})
83-
describe('Testing Conversion ofReamur to Celsius',()=>{
84-
it('withReamur value',()=>{
83+
describe('Testing Conversion ofReaumur to Celsius',()=>{
84+
it('withReaumur value',()=>{
8585
consttest1=tc.reaumurToCelsius(100)
8686
expect(test1).toBe(125)
8787
})
8888
})
89-
describe('Testing Conversion ofReamur to Fahrenheit',()=>{
90-
it('withReamur value',()=>{
89+
describe('Testing Conversion ofReaumur to Fahrenheit',()=>{
90+
it('withReaumur value',()=>{
9191
consttest1=tc.reaumurToFahrenheit(100)
9292
expect(test1).toBe(257)
9393
})
9494
})
95-
describe('Testing Conversion ofReamur to Kelvin',()=>{
95+
describe('Testing Conversion ofReaumur to Kelvin',()=>{
9696
it('with Reamur value',()=>{
9797
consttest1=tc.reaumurToKelvin(100)
9898
expect(test1).toBe(398)

‎Data-Structures/Array/LocalMaximomPoint.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Notes:
55
* - works by using divide and conquer
6-
* - the function gets the array A with n Realnumbersand returns the local max point index (if more than one exists return the first one)
6+
* - the function gets the array A with n Realnumbers and returns the local max point index (if more than one exists return the first one)
77
*
88
*@complexity: O(log(n)) (on average )
99
*@complexity: O(log(n)) (worst case)

‎Data-Structures/Tree/Trie.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ Trie.prototype.remove = function (word, count) {
8383
if(child.count>=count)child.count-=count
8484
elsechild.count=0
8585

86-
// If some occurrences are left wedont delete it or else
87-
// if the object forms some other objects prefix wedont delete it
86+
// If some occurrences are left wedon't delete it or else
87+
// if the object forms some other objects prefix wedon't delete it
8888
// For checking an empty object
8989
// https://stackoverflow.com/questions/679915/how-do-i-test-for-an-empty-javascript-object
9090
if(child.count<=0&&(Object.keys(child.children).length&&child.children.constructor===Object)){
@@ -110,7 +110,7 @@ Trie.prototype.contains = function (word) {
110110
returntrue
111111
}
112112

113-
Trie.prototype.findOccurences=function(word){
113+
Trie.prototype.findOccurrences=function(word){
114114
// find the node with given prefix
115115
constnode=this.findPrefix(word)
116116
// No such word exists

‎Dynamic-Programming/KadaneAlgo.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* Kadane's algorithm is one of the most efficient ways to
22
* calculate the maximum contiguous subarray sum for a given array.
3-
* Below is the implementation ofkadanes's algorithm along with
3+
* Below is the implementation ofKadane's algorithm along with
44
* some sample test cases.
55
* There might be a special case in this problem if al the elements
66
* of the given array are negative. In such a case, the maximum negative
@@ -10,14 +10,14 @@
1010
*/
1111

1212
exportfunctionkadaneAlgo(array){
13-
letcummulativeSum=0
13+
letcumulativeSum=0
1414
letmaxSum=Number.NEGATIVE_INFINITY// maxSum has the least possible value
1515
for(leti=0;i<array.length;i++){
16-
cummulativeSum=cummulativeSum+array[i]
17-
if(maxSum<cummulativeSum){
18-
maxSum=cummulativeSum
19-
}elseif(cummulativeSum<0){
20-
cummulativeSum=0
16+
cumulativeSum=cumulativeSum+array[i]
17+
if(maxSum<cumulativeSum){
18+
maxSum=cumulativeSum
19+
}elseif(cumulativeSum<0){
20+
cumulativeSum=0
2121
}
2222
}
2323
returnmaxSum

‎Dynamic-Programming/UniquePaths2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const uniquePaths2 = (obstacles) => {
6363
grid[0][j]=1
6464
}
6565
// Fill the rest of grid by dynamic programming
66-
// using followingreccurent formula:
66+
// using followingrecurrent formula:
6767
// K[i][j] = K[i - 1][j] + K[i][j - 1]
6868
for(leti=1;i<rows;i++){
6969
for(letj=1;j<columns;j++){

‎Geometry/Circle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* This class represents a circle and can calculate it's perimeter and area
33
* https://en.wikipedia.org/wiki/Circle
44
*@constructor
5-
*@param {number} radius - The radius of thecircule.
5+
*@param {number} radius - The radius of thecircle.
66
*/
77
exportdefaultclassCircle{
88
constructor(radius){

‎Graphs/BinaryLifting.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Binary Lifting implementation in Javascript
44
* Binary Lifting is a technique that is used to find the kth ancestor of a node in a rooted tree with N nodes
55
* The technique requires preprocessing the tree in O(N log N) using dynamic programming
6-
* Thetechniqe can answer Q queries about kth ancestor of any node in O(Q log N)
6+
* Thetechnique can answer Q queries about kth ancestor of any node in O(Q log N)
77
* It is faster than the naive algorithm that answers Q queries with complexity O(Q K)
88
* It can be used to find Lowest Common Ancestor of two nodes in O(log N)
99
* Tutorial on Binary Lifting: https://codeforces.com/blog/entry/100826

‎Graphs/LCABinaryLifting.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* Author: Adrito Mukherjee
3-
*Findind Lowest Common Ancestor By Binary Lifting implementation in JavaScript
3+
*Finding Lowest Common Ancestor By Binary Lifting implementation in JavaScript
44
* The technique requires preprocessing the tree in O(N log N) using dynamic programming)
55
* It can be used to find Lowest Common Ancestor of two nodes in O(log N)
66
* Tutorial on Lowest Common Ancestor: https://www.geeksforgeeks.org/lca-in-a-tree-using-binary-lifting-technique

‎Maths/BinomialCoefficient.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
/**
99
*@function findBinomialCoefficient
10-
*@description -> this function returnsbonimial coefficient
10+
*@description -> this function returnsbinomial coefficient
1111
* of two numbers n & k given by n!/((n-k)!k!)
1212
*@param {number} n
1313
*@param {number} k

‎Maths/CheckKishnamurthyNumber.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const CheckKishnamurthyNumber = (number) => {
3737
sumOfAllDigitFactorial+=factorial(lastDigit)
3838
newNumber=Math.floor(newNumber/10)
3939
}
40-
// if thesumOftheFactorial is equal to the given number it means the number is a Krishnamurthy number.
40+
// if thesumOfAllDigitFactorial is equal to the given number it means the number is a Krishnamurthy number.
4141
returnsumOfAllDigitFactorial===number
4242
}
4343

‎Maths/ExtendedEuclideanGCD.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Problem statement and explanation: https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm
33
*
4-
* This algorithm plays an important role for modular arithmetic, and by extension forcyptography algorithms
4+
* This algorithm plays an important role for modular arithmetic, and by extension forcryptography algorithms
55
*
66
* Basic explanation:
77
* The Extended Euclidean algorithm is a modification of the standard Euclidean GCD algorithm.

‎Maths/FermatPrimalityTest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* 1 / 2^50 = 8.8 * 10^-16 (a pretty small number)
2222
*
2323
* For comparison, the probability of a cosmic ray causing an error to your
24-
*infalible program is around 1.4 * 10^-15. An order of magnitude below!
24+
*infallible program is around 1.4 * 10^-15. An order of magnitude below!
2525
*
2626
* But because nothing is perfect, there's a major flaw to this algorithm, and
2727
* the cause are the so called Carmichael Numbers. These are composite numbers n

‎Maths/test/MeanAbsoluteDeviation.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('tests for mean absolute deviation', () => {
99
expect(()=>meanAbsoluteDeviation('fgh')).toThrow()
1010
})
1111

12-
it('should return the mean absolutedevition of an array of numbers',()=>{
12+
it('should return the mean absolutedeviation of an array of numbers',()=>{
1313
constmeanAbDev=meanAbsoluteDeviation([2,34,5,0,-2])
1414
expect(meanAbDev).toBe(10.479999999999999)
1515
})

‎Project-Euler/Problem003.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
// https://projecteuler.net/problem=3
22

33
exportconstlargestPrime=(num=600851475143)=>{
4-
letnewnumm=num
4+
letnewnum=num
55
letlargestFact=0
66
letcounter=2
7-
while(counter*counter<=newnumm){
8-
if(newnumm%counter===0){
9-
newnumm=newnumm/counter
7+
while(counter*counter<=newnum){
8+
if(newnum%counter===0){
9+
newnum=newnum/counter
1010
}else{
1111
counter++
1212
}
1313
}
14-
if(newnumm>largestFact){
15-
largestFact=newnumm
14+
if(newnum>largestFact){
15+
largestFact=newnum
1616
}
1717
returnlargestFact
1818
}

‎Project-Euler/Problem008.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
constlargestAdjacentNumber=(grid,consecutive)=>{
44
grid=grid.split('\n').join('')
5-
constsplitedGrid=grid.split('\n')
5+
constsplitGrid=grid.split('\n')
66
letlargestProd=0
77

8-
for(constrowinsplitedGrid){
9-
constcurrentRow=splitedGrid[row].split('').map(x=>Number(x))
8+
for(constrowinsplitGrid){
9+
constcurrentRow=splitGrid[row].split('').map(x=>Number(x))
1010

1111
for(leti=0;i<currentRow.length-consecutive;i++){
1212
constcombine=currentRow.slice(i,i+consecutive)

‎Project-Euler/Problem023.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515

1616
/**
17-
* collect the abundant numbers, generate and store their sums with each other, and check for numbers not in thellst of sums, adds them and returns their sum.
17+
* collect the abundant numbers, generate and store their sums with each other, and check for numbers not in thelist of sums, adds them and returns their sum.
1818
*@param {number} [n = 28123]
1919
*@returns {number}
2020
*/

‎Project-Euler/Problem028.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function problem28 (dim) {
4040
* Third corner: i^2 - 2 * (i - 1)
4141
* Fourth corner: i^2 - 3 * (i - 1)
4242
*
43-
* Doing the sum of each corner andsimplifing, we found that the result for each dimension is:
43+
* Doing the sum of each corner andsimplifying, we found that the result for each dimension is:
4444
* sumDim = 4 * i^2 + 6 * (1 - i)
4545
*
4646
* In this case I skip the 1x1 dim matrix because is trivial, that's why I start in a 3x3 matrix

‎Sorts/IntroSort.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
*@functionIntosort (As implemented in STD C++ Lib)
2+
*@functionIntrosort (As implemented in STD C++ Lib)
33
* The function performs introsort which is used in
44
* C++ Standard LIbrary, the implementation is inspired from]
55
* library routine itself.
@@ -88,7 +88,7 @@ function introsort (array, compare) {
8888
constTHRESHOLD=16
8989
/**
9090
*@constant TUNEMAXDEPTH
91-
* Constantusec to increase or decrease value
91+
* Constantused to increase or decrease value
9292
* of maxDepth
9393
*/
9494
constTUNEMAXDEPTH=1

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp