Overview
Variable-length encoding saves space when symbol frequencies are uneven, provided the code can be decoded unambiguously.
Represents common values with shorter codes and uncommon values with longer codes.
Compact metadata for implementation and discovery.
Variable-length encoding saves space when symbol frequencies are uneven, provided the code can be decoded unambiguously.
Quick facts
Runtime and memory behavior at a glance.
Best
O(n)
Average
O(n)
Worst
O(n)
Space
O(k)
E[length] = sum p(symbol) * code_length(symbol)Estimates average bits per encoded symbol.
Show symbols being transformed into codes and reconstructed by the decoder state.
Variable-Length Encoding should be used with the assumptions and tradeoffs of entropy Coding in mind.
What each reference supports for this entry.
Compression textbook support for Variable-Length Encoding's coding model, decoder behavior, and implementation tradeoffs.
Open sourceGood next jumps from the relationship graph, ranked for useful discovery.
Compression · Core
Small deltas are often compacted with variable-length codes.
Compare with thisCompression · Extended
Bit packing is often used alongside compact integer encodings.
Compare with thisElias delta coding is one variable-length integer code.
Elias gamma coding is one variable-length integer code.