I'm seeking for a proper structure for a big array which will be frequently updated. Thanks for your help! Here's the background: I want to draw a continuous curve to represent a sound wave in a certain time period. For the accuracy, the array length will be nearly 44100(the CD format).And I just want to represent the last second wave, so the array will be updated very frequently - for every 1/44100 sec, the first element will be eliminated and a new last element will be inserted to the array.
For avoiding the frequent "malloc/realloc/new", what my current solution is using an Circular Queue which has a fixed size as 44100, but somehow I don't feel this is most proper solution, if I want to dynamically resize the queue, it will be a heavy cost. This kind of situation should be quite often, I think there maybe some good patent for this issue. Thanks guys!