Pseudo-code
```
function detectPitchChange(double[] prev, double[] current) {
sum_low = 0
sum_high = 0
for (i=1; i sum_low += [ 1 ]
sum_high += [ 2 ]
}
if (sum_low > sum_high) {
return PITCH_GETS_LOWER
} else if (sum_low < sum_high) {
return PITCH_GETS_HIGHER
} else {
return PITCH_DOES_NOT_CHANGE
}
}
```

Code fragments:

1. (A) [tex]$\operatorname{prev}[i]$[/tex] current [tex]$[i-1]$[/tex]
2. (B) [tex]$\operatorname{prev}[i] \ \textless \ /em\ \textgreater \ $[/tex] current [tex]$[i+1]$[/tex]
3. (C) [tex]$(\operatorname{prev}[i]-\operatorname{current}[i-1]) \ \textless \ em\ \textgreater \ (\operatorname{prev}[i]-$[/tex] current [tex]$[i-1])$[/tex]
4. (D) [tex]$(\operatorname{prev}[i]-\operatorname{current}[i+1]) \ \textless \ /em\ \textgreater \ (\operatorname{prev}[i]-$[/tex] current [tex]$[i+1])$[/tex]
5. (E) (prev[i] - current [tex]$[i-1])$[/tex]
6. (F) (prev [tex]$[i]-$[/tex] current [tex]$[i+1])$[/tex]



Answer :

Sure! Let’s go through the solution step-by-step:

1. We are given two lists: `prev = [1, 2, 3, 4, 5]` and `current = [2, 3, 4, 5, 6]`.

2. We need to calculate `sum_low` and `sum_high`.
- `sum_low` calculates the sum of the differences between the elements of `prev` and the previous elements of `current`.
- `sum_high` calculates the sum of the differences between the elements of `prev` and the next elements of `current`.

For these sums, we will use only the elements with indices from `1` to `len(prev) - 2` (i.e., indices `1` to `3`).

3. Based on the pseudo-code, let's identify the correct options:
- `sum_low` corresponds to option (E): `sum_low += (prev[i] - current[i-1])`
- `sum_high` corresponds to option (F): `sum_high += (prev[i] - current[i+1])`

4. Let's break down the calculations:

a. When `i = 1` (second element):
- `sum_low`:
[tex]\[ sum\_low += prev[1] - current[1-1] = 2 - 2 = 0 \][/tex]
- `sum_high`:
[tex]\[ sum\_high += prev[1] - current[1+1] = 2 - 4 = -2 \][/tex]

b. When `i = 2` (third element):
- `sum_low`:
[tex]\[ sum\_low += prev[2] - current[2-1] = 3 - 3 = 0 \][/tex]
- `sum_high`:
[tex]\[ sum\_high += prev[2] - current[2+1] = 3 - 5 = -2 \][/tex]

c. When `i = 3` (fourth element):
- `sum_low`:
[tex]\[ sum\_low += prev[3] - current[3-1] = 4 - 4 = 0 \][/tex]
- `sum_high`:
[tex]\[ sum\_high += prev[3] - current[3+1] = 4 - 6 = -2 \][/tex]

5. Summing up the values:

- For `sum_low`:
[tex]\[ 0 + 0 + 0 = 0 \][/tex]
- For `sum_high`:
[tex]\[ -2 + -2 + -2 = -6 \][/tex]

6. Finally, we compare `sum_low` and `sum_high` to determine the pitch change:
- Since `sum_low` (0) is greater than `sum_high` (-6), the result is `PITCH_GETS_LOWER`.

So, the detailed, step-by-step solution is as follows:
- `sum_low` is computed as 0
- `sum_high` is computed as -6
- The pitch change is `PITCH_GETS_LOWER`

Thus, the final result is (0, -6, 'PITCH_GETS_LOWER').