Write a function called reverseSecondHalf that takes a sound as input, then reverses just the second half of the sound and returns the result. For example, if the sound said “MarkBark,” the returned sound should say “MarkkraB.”
What will be an ideal response?
```
def reverseSecondHalf(sound):
startIndex = getLength(sound)/2
endIndex=getLength(sound)
soundSamples = getSamples(sound)
target = makeEmptySound(endIndex-startIndex)
targetSamples = getSamples(target)
for index in range(startIndex, endIndex):
sourceValue = getSampleValue(soundSamples[index])
setSampleValue(targetSamples[index-startIndex], sourceValue)
for index in range(startIndex, endIndex):
sourceValue = getSampleValue(targetSamples[index-startIndex])
setSampleValue(soundSamples[endIndex-1-(index-startIndex)], sourceValue)
```
You might also like to view...
Which of the following statements is true?
a. Interpreted programs run faster than compiled programs. b. Compilers translate high-level language programs into machine language programs. c. Interpreter programs typically use machine language as input. d. None of the above.
________ is an I/O-performance-enhancement technique—it reduces the number of I/O operations by combining smaller outputs together in memory; the number of physical I/O operations is much smaller than the number of I/O requests issued by the program.
a. Aggregating b. Accumulating c. Amassing d. Buffering
Over time, disruptive innovation tends to become less attractive to users in a new market.
Answer the following statement true (T) or false (F)
Consider the same graph as in Problem 3 if the output signal to the block diagram shown in Figure 11.6 is fout = [ ? 2 , ? 1 , 3 , 9 , 0 , 0] T . Compute the input signal fin