diff --git a/README.md b/README.md index d29d7b1b..edac6451 100644 --- a/README.md +++ b/README.md @@ -150,6 +150,7 @@ algorithm is an abstraction higher than a computer program. * `B` [Rain Terraces](src/algorithms/uncategorized/rain-terraces) - trapping rain water problem * `A` [Maximum Subarray](src/algorithms/sets/maximum-subarray) * `A` [Travelling Salesman Problem](src/algorithms/graph/travelling-salesman) - shortest possible route that visits each city and returns to the origin city + * `A` [Discrete Fourier Transform](src/algorithms/math/fourier-transform) - decompose a function of time (a signal) into the frequencies that make it up * **Greedy** - choose the best option at the current time, without any consideration for the future * `B` [Jump Game](src/algorithms/uncategorized/jump-game) * `A` [Unbound Knapsack Problem](src/algorithms/sets/knapsack-problem) diff --git a/src/algorithms/math/fourier-transform/discreteFourierTransform.js b/src/algorithms/math/fourier-transform/discreteFourierTransform.js index fac5d4ca..d9213814 100644 --- a/src/algorithms/math/fourier-transform/discreteFourierTransform.js +++ b/src/algorithms/math/fourier-transform/discreteFourierTransform.js @@ -11,7 +11,7 @@ import ComplexNumber from '../complex-number/ComplexNumber'; */ export default function discreteFourierTransform(inputSignalAmplitudes) { const N = inputSignalAmplitudes.length; - const outpuFrequencies = []; + const outputFrequencies = []; // For every frequency discrete... for (let frequencyValue = 0; frequencyValue < N; frequencyValue += 1) { @@ -48,8 +48,8 @@ export default function discreteFourierTransform(inputSignalAmplitudes) { // Average contribution at this frequency signal = signal.divide(N); - outpuFrequencies[frequencyValue] = signal; + outputFrequencies[frequencyValue] = signal; } - return outpuFrequencies; + return outputFrequencies; }