Click here for program source.

Text to be compressed:
"This is what we're compressing, and is merely a test"
Or, enter your own string:

List of characters and their occurence:
y : 1
l : 1
o : 1
p : 1
d : 1
g : 1
, : 1
' : 1
c : 1
T : 1
w : 2
m : 2
n : 2
h : 2
r : 3
t : 3
a : 3
i : 4
s : 6
e : 6
: 9

Amount of objects in the array: 21

Building up code mappings according to tree: (pattern -x:yyy-, where x=letter and yyy=equivalent binary code)
- :00-e:010-s:011-a:1000-t:1001-o:101000-,:101001-n:10101-y:101100-l:101101-c:101110-T:101111-w:11000-m:11001-i:1101-h:11100-d:111010-g:111011-':111100-p:111101-r:11111

The binary form of the compressed string is:
10111111100110101100110101100110001110010001001001100001011110011111010001011101010001100111110111111010011011110110101111011101001001000101011110100011010110011001010111110101011011011000010000010010100111001
The length of the original string is 416, the compressed string is 209, the compression ratio is 50.24%.

Total execution time: 0.000632 seconds.