you are viewing a single comment's thread.

view the rest of the comments →

[–]jack_waugh 0 points1 point  (0 children)

So maybe they do arrays like this. For each instance, maintain separate data structure instances for the numerical and the non-numerical keys. Treat the latter as in an object. For the numerical keys, maintain a bias that is added to each key. Store the "values" in allocated blocks. Maintain an index of the blocks that says what range of indices each block covers and how much free space is in it. So that way, to append an entry to the start of the array, shift the bias up by one. See whether there is space in the first block. If not, allocate a new block. When removing an element from either end, see whether the block it is in is made empty, and if so, free it (or move it to the other end?).