Infant Respiratory Monitor Flex Sensor

Right before each sample I'd discard the oldest sample and shift all the array's values over one

Do some research on circular buffers, and there will be no need to shift the elements in the array around. You'd maintain an index to the oldest value. Then, just replace the oldest value with the newest value, and the next element in the array is now the oldest. When the oldest index is beyond the end of the array, the oldest index gets reset to 0.

After each reading, a simple pass through the array to find the minimum and maximum values will give you the amount of change over the period of time. It won't matter that the array is not in increasing order by time.