Hello,
here are the Huffman trees, and also a small fix in the algorithm:
replace line:
DISTANCE = D1 | D2
with:
DISTANCE = ( D1 | D2 ) + 1
BTW I have tried to implement it and it seems that it works.
Petr
here are the trees (the root of the tree is in the right, not in the left !):
-----------------------------------------------------------
Tree 1
----------------
00 010
01 11
02 001
03 110
04 1010
05 0010
06 1100
07 10100
08 00100
09 11000
0A 01000
0B 110000
0C 010000
0D 100000
0E 1000000
0F 0000000
Tree 2
----------------
00 11
01 1101
02 0101
03 1 1001
04 0 1001
05 1 0001
06 0 0001
07 11 1110
08 01 1110
09 10 1110
0A 00 1110
0B 11 0110
0C 01 0110
0D 10 0110
0E 00 0110
0F 11 1010
10 01 1010
11 10 1010
12 00 1010
13 11 0010
14 01 0010
15 10 0010
16 100 0010
17 000 0010
18 111 1100
19 011 1100
1A 101 1100
1B 001 1100
1C 110 1100
1D 010 1100
1E 100 1100
1F 000 1100
20 111 0100
21 011 0100
22 101 0100
23 001 0100
24 110 0100
25 010 0100
26 100 0100
27 000 0100
28 111 1000
29 011 1000
2A 101 1000
2B 001 1000
2C 110 1000
2D 010 1000
2E 100 1000
2F 000 1000
30 1111 0000
31 0111 0000
32 1011 0000
33 0011 0000
34 1101 0000
35 0101 0000
36 1001 0000
37 0001 0000
38 1110 0000
39 0110 0000
3A 1010 0000
3B 0010 0000
3C 1100 0000
3D 0100 0000
3E 1000 0000
3F 0000 0000