Skip to content

Commit 002b10a

Browse files
authored
docs: fix typos (TheAlgorithms#1283)
* docs: fix typos * fix
1 parent 8cd86b1 commit 002b10a

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 the agrsKey generate to -> '[[1,2,3,4],{"name":"myName","age":23}]' which is JSON mean string
33+
* Then the argsKey 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
const argsKey = 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 and ecrypt function', () => {
22+
it('Test - 3 Pass string value to encrypt and decrypt 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
const word = 'Hello world!'
55
const result = 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
const word = 'The Algorithms'
1111
const result = 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
const word = 'Hello world!'
55
const result = 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
const word = 'The Algorithms'
1111
const result = 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
const binaryToHex = (binaryString) => {
3131
/*
32-
Function for convertung Binary to Hex
32+
Function for converting 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
return new TypeError('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 of Reamur to Celsius', () => {
84-
it('with Reamur value', () => {
83+
describe('Testing Conversion of Reaumur to Celsius', () => {
84+
it('with Reaumur value', () => {
8585
const test1 = tc.reaumurToCelsius(100)
8686
expect(test1).toBe(125)
8787
})
8888
})
89-
describe('Testing Conversion of Reamur to Fahrenheit', () => {
90-
it('with Reamur value', () => {
89+
describe('Testing Conversion of Reaumur to Fahrenheit', () => {
90+
it('with Reaumur value', () => {
9191
const test1 = tc.reaumurToFahrenheit(100)
9292
expect(test1).toBe(257)
9393
})
9494
})
95-
describe('Testing Conversion of Reamur to Kelvin', () => {
95+
describe('Testing Conversion of Reaumur to Kelvin', () => {
9696
it('with Reamur value', () => {
9797
const test1 = 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 Real numbersand returns the local max point index (if more than one exists return the first one)
6+
* - the function gets the array A with n Real numbers 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
else child.count = 0
8585

86-
// If some occurrences are left we dont delete it or else
87-
// if the object forms some other objects prefix we dont delete it
86+
// If some occurrences are left we don't delete it or else
87+
// if the object forms some other objects prefix we don'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
return true
111111
}
112112

113-
Trie.prototype.findOccurences = function (word) {
113+
Trie.prototype.findOccurrences = function (word) {
114114
// find the node with given prefix
115115
const node = 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 of kadanes's algorithm along with
3+
* Below is the implementation of Kadane'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
export function kadaneAlgo (array) {
13-
let cummulativeSum = 0
13+
let cumulativeSum = 0
1414
let maxSum = Number.NEGATIVE_INFINITY // maxSum has the least possible value
1515
for (let i = 0; i < array.length; i++) {
16-
cummulativeSum = cummulativeSum + array[i]
17-
if (maxSum < cummulativeSum) {
18-
maxSum = cummulativeSum
19-
} else if (cummulativeSum < 0) {
20-
cummulativeSum = 0
16+
cumulativeSum = cumulativeSum + array[i]
17+
if (maxSum < cumulativeSum) {
18+
maxSum = cumulativeSum
19+
} else if (cumulativeSum < 0) {
20+
cumulativeSum = 0
2121
}
2222
}
2323
return maxSum

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy