3 ms·
I think the second solution from SO is almost the same as yours, including having begun with Golomb coding: http://preshing.com/20121026/1mb-sorting-explained h
by aasasd 7y ago
I think the second solution from SO is almost the same as yours, including having begun with Golomb coding: http://preshing.com/20121026/1mb-sorting-explained http://preshing.com/20121026/1mb-sorting-explained
However, they explain that Golomb coding isn't quite enough for the 1M case and switch to arithmetic coding instead.
- contravariant 7y agoAh seems I was a bit too optimistic with my estimation of the number of bits. Shame, that means a simple solution is pretty much impossible.