Best way to have an list of indices which changes order
Need some advice about how best to do this in C.
I need a list of indices which specify the order in which the elements of an array will be accessed for a specific purpose (the order of the accessed array must stay constant, it's only for this special case that its elements must be accessed in a variable order). This order will change in the following way: When one index is 'selected' it should move from its current position in the list to the first position.
The number of elements is relatively small, i.e. probably < 15 in most cases.
What's the best way to do this? As a linked list, or as an array of ints that gets rebuilt every time, or some other way?