See http://en.wikipedia.org/wiki/Run-length_encoding
Performs well with highly repetitive data e.g. [0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3]
. Performs very bad with data containing repeating patterns e.g. [0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3]
.
Returns an array with length, value pairs.
Array must be length, value pairs.