Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c4eead4

Browse files
committedOct 18, 2018
fix typos
1 parent 0cdb6b3 commit c4eead4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed
 

‎src/algorithms/math/karatsuba-multiplication/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ d = 78
2727

2828
3. Combine subexpressions to calculate the product
2929
```
30-
A = ac * 1000
30+
A = ac * 10000
3131
B = (abcd - ac - bd) * 100
3232
C = bd
3333

‎src/algorithms/math/karatsuba-multiplication/karatsuba.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default function karatsuba(x, y) {
1515
// SCALE FACTOR:
1616
// scaleFactor is used to split the numbers
1717
// into smaller numbers for recursion.
18-
// when combining the subcomputations back
18+
// when combining the subexpressions back
1919
// together, the scaleFactor is used to
2020
// recreate the magnitude of the original numbers
2121
const minDigits = Math.min(
@@ -48,14 +48,14 @@ export default function karatsuba(x, y) {
4848
// d = 5678 - (56 * 100) = 5678 - 5600 = 78
4949
const d = y - (c * scaleFactor);
5050

51-
// COMPUTE SUB-EXPRESSIONS:
51+
// COMPUTE SUBEXPRESSIONS:
5252
// since a + b is less than x, and c + d is less than y
5353
// the recursion is guaranteed to reach the base case
5454
const ac = karatsuba(a, c);
5555
const bd = karatsuba(b, d);
5656
const abcd = karatsuba(a + b, c + d);
5757

58-
// COMBINE SUB-EXPRESSIONS:
58+
// COMBINE SUBEXPRESSIONS:
5959
// since the scaleFactor was used to
6060
// reduce the size of the components,
6161
// the scaleFactor must be applied in reverse

0 commit comments

Comments
 (0)
Please sign in to comment.