Skip to main content
1 of 2
JsCoder
  • 101
  • 2

Ways to compact arrays

I'm looking for some common algos geared at storing arrays in a compact format using the underlying data particularities, such as:

  • repeating items, which can be stored by-reference (ex. [index]a, where index is the first occurrence and a..z is the actual repetition)
  • sequential values, which can be presented by x..y
  • other ideas?? possibly "lingual" algos, using specially constructed dictionaries?

I have arrays of 100-10000 non-unique integers (%% of dups is 10%-40%), ranging from 0..255, which I need to store in a maximum compact way. I'd appreciate if anyone can point out any suitable algos.

JsCoder
  • 101
  • 2