2 ms·
The problem is inadequately defined. Basically it depends on whether you expect to have to record more than 32000 / 14 = 2200 or so values, in which case simpl
by podperson 16y ago
The problem is inadequately defined.
Basically it depends on whether you expect to have to record more than 32000 / 14 = 2200 or so values, in which case simply keep a sorted list of the actual integers using a sorting/insertion algorithm of your choice, or you expect to receive fewer than 8 occurrences of a given integer, in which case use a 10,000 x 3-bit deep bitmap, or you don't care how many occurrences of each integer there were, in which case use a 10,000 x 1-bit deep bitmap.
In any event the unintelligible and buggy proposed solution doesn't seem like a good choice.