Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Truncated binary encoding
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Example with ''n'' = 5== For example, for the alphabet {0, 1, 2, 3, 4}, ''n'' = 5 and 2<sup>2</sup> β€ ''n'' < 2<sup>3</sup>, hence ''k'' = 2 and ''u'' = 2<sup>3</sup> β 5 = 3. Truncated binary encoding assigns the first ''u'' symbols the codewords 00, 01, and 10, all of length 2, then assigns the last ''n'' β ''u'' symbols the codewords 110 and 111, the last two codewords of length 3. For example, if ''n'' is 5, plain binary encoding and truncated binary encoding allocates the following [[Code word (communication)|codewords]]. Digits shown <del>struck</del> are not transmitted in truncated binary. {| class="wikitable" style="text-align:center" |- ! Truncated<br/>binary !!colspan=3| Encoding !! Standard<br/>binary |- |align=right| 0 ||bgcolor=silver| <del>0</del> || 0 || 0 ||align=left| 0 |- |align=right| 1 ||bgcolor=silver| <del>0</del> || 0 || 1 ||align=left| 1 |- |align=right| 2 ||bgcolor=silver| <del>0</del> || 1 || 0 ||align=left| 2 |- |align=right| UNUSED ||bgcolor=silver| <del>0</del> ||bgcolor=silver| <del>1</del> ||bgcolor=silver| <del>1</del> ||align=left| 3 |- |align=right| UNUSED ||bgcolor=silver| <del>1</del> ||bgcolor=silver| <del>0</del> ||bgcolor=silver| <del>0</del> ||align=left| 4 |- |align=right| UNUSED ||bgcolor=silver| <del>1</del> ||bgcolor=silver| <del>0</del> ||bgcolor=silver| <del>1</del> ||align=left| 5/UNUSED |- |align=right| 3 || 1 || 1 || 0 ||align=left| 6/UNUSED |- |align=right| 4 || 1 || 1 || 1 ||align=left| 7/UNUSED |} It takes 3 bits to encode ''n'' using straightforward binary encoding, hence 2<sup>3</sup> β ''n'' = 8 β 5 = 3 are unused. In numerical terms, to send a value ''x'', where 0 β€ ''x'' < ''n'', and where there are 2<sup>''k''</sup> β€ ''n'' < 2<sup>''k''+1</sup> symbols, there are ''u'' = 2<sup>''k''+1</sup> β ''n'' unused entries when the alphabet size is rounded up to the nearest power of two. The process to encode the number ''x'' in truncated binary is: if ''x'' is less than ''u'', encode it in ''k'' binary bits; if ''x'' is greater than or equal to ''u'', encode the value ''x'' + ''u'' in ''k'' + 1 binary bits.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)