Predict the complete cost
Counts 8,4,2,2; prefix lengths 1,2,3,3.
Compute payload before adding a one-byte header.
1 / 5
Counts 8,4,2,2; prefix lengths 1,2,3,3.
Compute payload before adding a one-byte header.
Payload = 8+8+6+6 = 28 bits, padded to 4 bytes.
Fixed two-bit symbols also occupy 4 bytes. With a one-byte header, the modeled representation occupies 5.
Expected length and complete file length answer different questions.
Lengths [1,2,3,3]: 1/2+1/4+1/8+1/8 = 1.
Try adding another length-three symbol: the sum exceeds one.
An unused branch is allowed; an overlapping prefix is not.
Compare AAAABBBB with ABABABAB.
A byte histogram cannot distinguish their structure. A context or dictionary model can.
A zero-probability prediction for a possible byte leaves no representation unless an escape rule exists.
A 40-bit model header saves two payload bits per symbol.
Twenty symbols tie before padding; twenty-one first improve bit cost. Then round each total to bytes.
For [6,3,3] at lengths [1,2,2], verify 18 payload bits and 1.5 bits/symbol.