Memoirs of a Technocrat

by Niroshan Rajadurai

  • Increase font size
  • Default font size
  • Decrease font size

Data Compression

E-mail Print PDF
User Rating: / 0
PoorBest 

The following data is a time series of integer values:

int timeseries[32] = {67497, 67376, 67173, 67235, 67057, 67031, 66951, 66974, 67042, 67025, 66897, 67077, 67082, 67033, 67019, 67149, 67044, 67012, 67220, 67239, 66893, 66984, 66866, 66693, 66770, 66722, 66620, 66579, 66596, 66713, 66852, 66715};

The series might be, for example, the closing price of a stock each day over a 32 day period.

As stored above, the data will occupy 32 x sizeof(int) bytes = 128 bytes assuming 4 byte ints.

Using delta encoding , write a function to compress, and a function to uncompress data like the above.

Comments (0)
Last Updated on Monday, 24 January 2011 12:26