Shouldn't the foreach loop run from i = 0 ... N/2?
This comment was marked helpful 0 times.
jpaulson
No. N/2 is being passed in.
This comment was marked helpful 0 times.
stephyeung
We noted in class that this implementation is better than one implemented in, say, MATLAB. The reason being that if we abstracted how our program would work in MATLAB, we would have it first create some temporary array storing all of our values, and then have to iterate through this temp again to duplicate each value, which means we would've iterated through the array twice.
Shouldn't the foreach loop run from i = 0 ... N/2?
This comment was marked helpful 0 times.
No. N/2 is being passed in.
This comment was marked helpful 0 times.
We noted in class that this implementation is better than one implemented in, say, MATLAB. The reason being that if we abstracted how our program would work in MATLAB, we would have it first create some temporary array storing all of our values, and then have to iterate through this temp again to duplicate each value, which means we would've iterated through the array twice.
This comment was marked helpful 0 times.