What would be the best way to maintain and sort a fixed-size array (or linked list?)? To make situation clear, suppose that 100 samples of data are stored in a buffer (assume they're sorted for simplicity), then when the next sample comes in, oldest one goes out and the new sample must be put in the buffer in a location such that its sorted.
What would be the best way to store these samples, arrays or linked list? And how to sort the list for the latest chunk of sample?
[Initially the buffer may be initialized to 0]