I just wrote one and would like to see if it is giving the same number of bits requred for a given string. If you happen to have one, please put the same input string into your program to see if you get the same number of bits out. And yes, the string is spelled wrong.
The input string is:
WHENEVER ANY TEXT MESSAGE OF PRINTABLE ASCII CHARACTERS IS ENCODED BY THE HUFFMAN CODE PROCESS THEN THE TOTAL NUMBER OF BITS USED IS GARANTEED TO BE MINIMUM.
The bitstring is:
0011111011010001101001111110011110000010001100111100011001001010111100000001010011101110010010111010000001110110110001011111111010100011011000100110100011101000000100111001010101001010000001010101100100111100100010101100100111101110000101001110000100011001010011100101110001011000110100111100011001011010000010110001101101111011001001000110000010100111001011100000101111111100111001010100111011100001100101101000110000110010110100000110001110110001000011100000110001100010110101001111000001110110110001101010100110011100000011011101000101100010100111000010111001001111001000110110010010001011000110001110000110101000000010101000110101000010001100010101010
There were 1256 bits used by the input string and 655 bits used by the output string, which gives the compression ratio of 1.917557:1.
The data table is:
Character Frequency Next Binary Code
26 -1 000
. 1 -1 101010
A 10 -1 0100
B 5 -1 11010
C 6 -1 01010
D 5 -1 01011
E 20 -1 100
F 4 -1 11011
G 2 -1 101110
H 6 -1 10110
I 8 -1 10100
L 2 -1 001110
M 6 -1 0010
N 9 -1 0110
O 7 -1 01110
P 2 -1 101111
R 7 -1 11110
S 10 -1 1110
T 12 -1 1100
U 4 -1 00110
V 1 -1 11111
W 1 -1 001111
X 1 -1 101011
Y 2 -1 01111
The input string is:
WHENEVER ANY TEXT MESSAGE OF PRINTABLE ASCII CHARACTERS IS ENCODED BY THE HUFFMAN CODE PROCESS THEN THE TOTAL NUMBER OF BITS USED IS GARANTEED TO BE MINIMUM.
The bitstring is:
0011111011010001101001111110011110000010001100111100011001001010111100000001010011101110010010111010000001110110110001011111111010100011011000100110100011101000000100111001010101001010000001010101100100111100100010101100100111101110000101001110000100011001010011100101110001011000110100111100011001011010000010110001101101111011001001000110000010100111001011100000101111111100111001010100111011100001100101101000110000110010110100000110001110110001000011100000110001100010110101001111000001110110110001101010100110011100000011011101000101100010100111000010111001001111001000110110010010001011000110001110000110101000000010101000110101000010001100010101010
There were 1256 bits used by the input string and 655 bits used by the output string, which gives the compression ratio of 1.917557:1.
The data table is:
Character Frequency Next Binary Code
26 -1 000
. 1 -1 101010
A 10 -1 0100
B 5 -1 11010
C 6 -1 01010
D 5 -1 01011
E 20 -1 100
F 4 -1 11011
G 2 -1 101110
H 6 -1 10110
I 8 -1 10100
L 2 -1 001110
M 6 -1 0010
N 9 -1 0110
O 7 -1 01110
P 2 -1 101111
R 7 -1 11110
S 10 -1 1110
T 12 -1 1100
U 4 -1 00110
V 1 -1 11111
W 1 -1 001111
X 1 -1 101011
Y 2 -1 01111