Will you 'use' consecutive integers? I.e. can you keep track of the first and last you used (or a list of ranges you've used)?
Ernest Friedman-Hill wrote:The Java equivalent would be to use a HashSet; it would work pretty much the same way:
Ernest Friedman-Hill wrote:...but it uses just one huge 500M block of memory.
Ernest Friedman-Hill wrote:As DOM points out, BitSet implements this for you.
Campbell Ritchie wrote:Don't have a topcoder account, I am afraid.
Campbell Ritchie wrote:Sounds a good idea, but I need to go and do some cooking now
Campbell Ritchie wrote:When the wife wants her dinner and there's nothing to eat, I would have to work out an algorithm for getting out alive