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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp