A bit map compression scheme consists of a bit map and a physical database which stores the non-constant values. The bit map is employed to indicate the presence or absence of non-constant data. The following example shows how the bit map compression scheme can be employed to implement a version of constant suppression.
Original data string
d1, c, c, d2, c, c, c, d3
Compressed data string
Bit map: 10010001.
Physical database: dl, d2, d3.
For the bit map compression method, the mapping mechanism must search the whole bit map for both forward and backward mapping. And thus, the access time for both forward and backward mapping is O(N), where N is the number of bits in the bit map or equivalently the number of elements in the database.
Program in CPP:
From the above theory, we have designed the program that is stated below. this program takes input from the secondary memory as binary (.bin) file.
Continue reading “Bit Map Compression of Binary Files”