<s>
In	O
coding	B-Error_Name
theory	I-Error_Name
a	O
variable-length	B-Algorithm
code	I-Algorithm
is	O
a	O
code	O
which	O
maps	O
source	O
symbols	O
to	O
a	O
variable	O
number	O
of	O
bits	O
.	O
</s>
<s>
Variable-length	B-Algorithm
codes	I-Algorithm
can	O
allow	O
sources	O
to	O
be	O
compressed	B-General_Concept
and	O
decompressed	O
with	O
zero	O
error	O
(	O
lossless	B-Algorithm
data	I-Algorithm
compression	I-Algorithm
)	O
and	O
still	O
be	O
read	O
back	O
symbol	O
by	O
symbol	O
.	O
</s>
<s>
With	O
the	O
right	O
coding	O
strategy	O
an	O
independent	O
and	O
identically-distributed	O
source	O
may	O
be	O
compressed	B-General_Concept
almost	O
arbitrarily	O
close	O
to	O
its	O
entropy	O
.	O
</s>
<s>
This	O
is	O
in	O
contrast	O
to	O
fixed	O
length	O
coding	O
methods	O
,	O
for	O
which	O
data	B-General_Concept
compression	I-General_Concept
is	O
only	O
possible	O
for	O
large	O
blocks	O
of	O
data	O
,	O
and	O
any	O
compression	O
beyond	O
the	O
logarithm	O
of	O
the	O
total	O
number	O
of	O
possibilities	O
comes	O
with	O
a	O
finite	O
(	O
though	O
perhaps	O
arbitrarily	O
small	O
)	O
probability	O
of	O
failure	O
.	O
</s>
<s>
Some	O
examples	O
of	O
well-known	O
variable-length	B-Algorithm
coding	I-Algorithm
strategies	O
are	O
Huffman	B-General_Concept
coding	I-General_Concept
,	O
Lempel	B-Algorithm
–	I-Algorithm
Ziv	I-Algorithm
coding	I-Algorithm
,	O
arithmetic	B-Algorithm
coding	I-Algorithm
,	O
and	O
context-adaptive	B-Algorithm
variable-length	I-Algorithm
coding	I-Algorithm
.	O
</s>
<s>
Variable-length	B-Algorithm
codes	I-Algorithm
can	O
be	O
strictly	O
nested	O
in	O
order	O
of	O
decreasing	O
generality	O
as	O
non-singular	O
codes	O
,	O
uniquely	O
decodable	O
codes	O
and	O
prefix	O
codes	O
.	O
</s>
<s>
For	O
example	O
,	O
the	O
mapping	O
is	O
not	O
non-singular	O
because	O
both	O
"	O
a	O
"	O
and	O
"	O
b	O
"	O
map	O
to	O
the	O
same	O
bit	O
string	O
"	O
0	O
"	O
;	O
any	O
extension	O
of	O
this	O
mapping	O
will	O
generate	O
a	O
lossy	O
(	O
non-lossless	O
)	O
coding	O
.	O
</s>
<s>
Such	O
singular	O
coding	O
may	O
still	O
be	O
useful	O
when	O
some	O
loss	O
of	O
information	O
is	O
acceptable	O
(	O
for	O
example	O
when	O
such	O
code	O
is	O
used	O
in	O
audio	O
or	O
video	O
compression	O
,	O
where	O
a	O
lossy	O
coding	O
becomes	O
equivalent	O
to	O
source	O
quantization	B-Algorithm
)	O
.	O
</s>
<s>
However	O
,	O
the	O
mapping	O
is	O
non-singular	O
;	O
its	O
extension	O
will	O
generate	O
a	O
lossless	B-Algorithm
coding	O
,	O
which	O
will	O
be	O
useful	O
for	O
general	O
data	O
transmission	O
(	O
but	O
this	O
feature	O
is	O
not	O
always	O
required	O
)	O
.	O
</s>
<s>
Whether	O
a	O
given	O
code	O
is	O
uniquely	O
decodable	O
can	O
be	O
decided	O
with	O
the	O
Sardinas	B-Algorithm
–	I-Algorithm
Patterson	I-Algorithm
algorithm	I-Algorithm
.	O
</s>
<s>
The	O
latter	O
are	O
not	O
very	O
useful	O
in	O
the	O
context	O
of	O
source	B-General_Concept
coding	I-General_Concept
,	O
but	O
often	O
serve	O
as	O
error	B-Error_Name
correcting	I-Error_Name
codes	I-Error_Name
in	O
the	O
context	O
of	O
channel	O
coding	O
.	O
</s>
<s>
The	O
advantage	O
of	O
a	O
variable-length	B-Algorithm
code	I-Algorithm
is	O
that	O
unlikely	O
source	O
symbols	O
can	O
be	O
assigned	O
longer	O
codewords	O
and	O
likely	O
source	O
symbols	O
can	O
be	O
assigned	O
shorter	O
codewords	O
,	O
thus	O
giving	O
a	O
low	O
expected	O
codeword	O
length	O
.	O
</s>
