mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-12-27 15:41:16 +08:00
Fix typos.
This commit is contained in:
parent
12d649e372
commit
a88c45a329
@ -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
|
* `B` [Rain Terraces](src/algorithms/uncategorized/rain-terraces) - trapping rain water problem
|
||||||
* `A` [Maximum Subarray](src/algorithms/sets/maximum-subarray)
|
* `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` [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
|
* **Greedy** - choose the best option at the current time, without any consideration for the future
|
||||||
* `B` [Jump Game](src/algorithms/uncategorized/jump-game)
|
* `B` [Jump Game](src/algorithms/uncategorized/jump-game)
|
||||||
* `A` [Unbound Knapsack Problem](src/algorithms/sets/knapsack-problem)
|
* `A` [Unbound Knapsack Problem](src/algorithms/sets/knapsack-problem)
|
||||||
|
@ -11,7 +11,7 @@ import ComplexNumber from '../complex-number/ComplexNumber';
|
|||||||
*/
|
*/
|
||||||
export default function discreteFourierTransform(inputSignalAmplitudes) {
|
export default function discreteFourierTransform(inputSignalAmplitudes) {
|
||||||
const N = inputSignalAmplitudes.length;
|
const N = inputSignalAmplitudes.length;
|
||||||
const outpuFrequencies = [];
|
const outputFrequencies = [];
|
||||||
|
|
||||||
// For every frequency discrete...
|
// For every frequency discrete...
|
||||||
for (let frequencyValue = 0; frequencyValue < N; frequencyValue += 1) {
|
for (let frequencyValue = 0; frequencyValue < N; frequencyValue += 1) {
|
||||||
@ -48,8 +48,8 @@ export default function discreteFourierTransform(inputSignalAmplitudes) {
|
|||||||
// Average contribution at this frequency
|
// Average contribution at this frequency
|
||||||
signal = signal.divide(N);
|
signal = signal.divide(N);
|
||||||
|
|
||||||
outpuFrequencies[frequencyValue] = signal;
|
outputFrequencies[frequencyValue] = signal;
|
||||||
}
|
}
|
||||||
|
|
||||||
return outpuFrequencies;
|
return outputFrequencies;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user