Regarding efficiency, simple operations such as moving averages can be improved tremendously using double-ended queues, or deques. Oddly enough, it is pronounced "deck". Deques are another friend of the engineer, as they make a simple FIFO buffer. Lists can be used as a crude FIFO, but they do not scale well. Adding new elements to a list with |