Research Article

An Adaptive Lossless Data Compression Scheme for Wireless Sensor Networks

Algorithm 3

Pseudo-code of the encode () function.
encode( di , TABLE, ci )
// is the current residue value
// TABLE is the variable length Huffman codes used in encoding
// is the category (group number) of
// is also the number of lower order bits needed to encode the value of
// is the encoded bitstream of
// is the variable-length Huffman code that codifies the category (group) of
// is the variable-length integer code that codifies the index position of
// within its group (category)
// *denotes concatenation
// (Index)∣ denotes the binary representation of index over bits
// compute category
IF THEN
 SET TO 0
ELSE
 SET TO
ENDIF
// extract the variable length Huffman code from TABLE
SET TO TABLE
// build
IF THEN
 // is not needed
 SET TO
ELSE
 // build
 SET TO (Index)∣
 // build
 SET TO *
ENDIF
RETURN