Data compression is often referred to as coding, where coding is a very general term encompassing any special representation of data which satisfies a given need.
A simple characterization of data compression is that it involves transforming a string of characters in some representation (such as ASCII) into a new string (of bits, for example) which contains the same information but whose length is as small as possible. Data compression has important application in the areas of data transmission and data storage. Many data processing applications require storage of large volumes of data, and the number of such applications is constantly increasing as the use of computers extends to new disciplines.
i am able to fetch data from a file and save it in an array ,
now i am stuck up in the part where i have to fetch each char in such a manner that it occurs only once.
string: she sells sea shells…
Two loops, inner and outer.
outer loop: assign a variable with 1st character and increment
inner loop: check if variable = next character of string.if yes then next iteration(continue) if no then read the char in a buffer.
note:characters may be read again and again for which buffer is also needed to be compared every time inner loop finishes.For that buffer index must be made zero when in outer loop.