but I didn't know what the rules were.

There is also, the obvious 50% optimization. If more than half the numbers are allocated, I only track those that are not. Otherwise I track those that are. Thus my worst case scenario moves to 50% allocated and my memory requirements are potentially cut by half.