Quote:
have a large array with a range of integers that are mostly not continuous, eg 1-100,1-1000 etc.
This is not clear to me.
Quote:
All numbers are unique and different increasing.
If the numbers belongs to a range (e.g.
1-10000
) then you may use just the necessary bits to store them (
14
bits are enough for storing
0-16383
).
For number increasing monotonically you may store the first number and then the differences between the next and the previous. Storing such differences usually requires fewer bits than storing the whole numbers.
Of course you may also try an available, general compression facility like the one suggested by Richard.