I need a data structure which can hold a set of numbers and sort them as quick as possible.
I thought a list would be good because inserting a new number in to the list would be easier than a vector (which would require copying the elements after the insertion). However, traversing the linked list (I am using the sorted list as a lookup to grab objects from an unordered_map) is likely to be much slower because the memory is scattered throughout the heap.
I was thinking of using a map, but wouldn't this also have a bad memory access due to the non-continuous nature?
A statically-allocated array (with lots of empty space) and a fast sorting algorithm is another idea I thought upon.....
To recap- I need a data structure which allows me to insert new elements and re-sort the elements as quick as possible. The elements will be numbers.
Any help is appreciated?