text
stringlengths 0
99.6k
|
|---|
--------- ---------
|
a 5
|
b 2
|
r 2
|
c,d 2
|
And we have a partial tree:
|
d
|
/
|
root - c
|
Now we repeat the procedure. This time, however, we
|
have more than one choice. We could choose "b" and "r", or
|
"b" and "c,d" or "r" and "c,d". As far as the resulting file
|
is concerned, it makes no difference which one we choose.
|
The squeezed files length will be the same! Lets do it two
|
different ways just to see what happens.
|
character frequency character frequency
|
--------- --------- --------- ---------
|
a 5 a 5
|
b,r 4 c,d,r 4
|
c,d 2 b 2
|
Which gives:
|
b c r d
|
/ / / /
|
root - r root - d root - - c
|
And again:
|
character frequency character frequency
|
--------- --------- --------- ---------
|
c,d,b,r 6 c,d,b,r 6
|
a 5 a 5
|
Which gives:
|
d
|
/
|
/--c
|
/
|
/ b or: b r d
|
/ / / / /
|
root -- - r root - - - - c
|
ARC VERSION 2.20 PAGE - 34
|
And finally we combine these to get:
|
d
|
/
|
/--c
|
/
|
a / b or: a b r d
|
/ / / / / / /
|
root - - - - -r root - - - - - c
|
We end up with the following tables:
|
character frequency code1 code2
|
--------- --------- ----- -----
|
a 5 0 0
|
b 2 110 10
|
r 2 111 110
|
c 1 101 1111
|
d 1 100 1110
|
If you multiply the code length times the frequency for
|
each character and sum the results, you will get the files
|
squeezed length in bits. You will find that it is the same
|
in both cases. ARC will, however, always choose the option
|
which results in the shortest code lengths. ARC only allows
|
a maximum code length of 24 bits. Note also that there are a
|
total of only 13 bits on the left, but 14 on the right. This
|
also makes the length of the encoding table a bit shorter.
|
No pun intended.
|
Since we are building the codes two groups at a time,
|
the time that it takes to generate the codes is directly
|
proportional to the number of entries in the table. After
|
ARC finishes its analyze pass, you will notice a delay of a
|
second or two before ARC actually starts squeezing a file.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.