I have an array x of constant size (usually around 100-200 entries) and would like to add an array y of constant smaller size (usually between 2-10 entries) to the head, while removing the same size at the end. For example:
Buffer: x = [6 5 4 3 2 1]
New array to add in front: y = [8 7]
Resulting buffer: x = [8 7 6 5 4 3]
And so on...
Note: I need to use a regular C array and need to be able to access the whole array, not only the head or tail. The array is rather small, but the function is called very often, so I am looking for a solution that does not require any excessive memory tasks. Arrays x and y are always of the same size in each step.
Is this a buffer, circular / ring buffer, queue or FIFO? I don't really know what the right search term is for this application.
Language is C.