Remix.run Logo
adrian_b 5 days ago

With indices what you say can be implemented trivially, much simpler than with pointers, by always incrementing a reallocated index (i.e. an index extracted from the free list) with the array size and always addressing the array with the indices modulo the array size.

With the array size chosen to be a power of two, this adds negligible overhead in time and no overhead in space.

duped 5 days ago | parent [-]

That's equivalent to packing two counters into one.

adrian_b 5 days ago | parent [-]

True.