'calculating previous values knowing current value and constant number of variables

i got this data stream of events and time they arrived:

time value
1 0.7
2 1.1
3 1.5
4 1.6
5 1.8
6 2.4

for instance - in time 3 value 1.5 arrived to the system.

is there any chance saving only the last value and other constant number of variables in order to retrieve all the other values? for example - in time 4.5 to save the value 1.6 (and other constant number of variables) and to be able to retrieve 1.5, 1.1 and 0.7?

  • values are sorted low to high (if it matters)

Thank you



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source