An array represents the status of a sequence of 7 weather sensors along a mountain trail. Each sensor can be either active (A) or idle (I).
| Subroutine | Explanation |
|---|---|
INVERT(n) | If the sensor at index nnn is A, it is set to I. If it is I, it is set to A. |
COPY_LST(n) | The sensor at index nnn is set to the same status as the sensor at index (n−1n - 1n−1). |
RESET_RANGE(m, n) | All sensors between index mmm and index nnn (but not including mmm and nnn) are set to I. |
| 0 | 1 | 2 | 3 | 4 | 5 | 6 |
|---|---|---|---|---|---|---|
| I | A | A | I | A | I | I |
What will the array of sensors become after the following algorithm is executed?
p ← 2
INVERT(p + 2)
COPY_LST(p - 1)
INVERT(p + 1)
Write your final answer in the table below:
| 0 | 1 | 2 | 3 | 4 | 5 | 6 |
|---|