Reputation: 2963
Given that the array of unique uint32 is an ordered fixed-width'ed sequence and its size can vary from thousand to million, what's the options there to compress it to minimal size?
Upvotes: 0
Views: 209
Reputation: 19601
Start by replacing it with an note of the first value and an array of differences between successive values. The easiest thing to do would be to run some general purpose compression algorithm like zip on the array of differences. If you wanted to do something from scratch you might try encoding the differences as http://en.wikipedia.org/wiki/Elias_omega_coding and then using a http://en.wikipedia.org/wiki/Huffman_coding on the result, treated as a byte stream or perhaps stream of 16-bit values.
Upvotes: 2