Content deleted Content added
m Phrase about unary numeral system |
|||
Line 1:
'''Unary coding''',<ref group="nb" name="NB1"/> or the '''unary numeral''' system and also sometimes called '''thermometer code''', is an [[entropy encoding]] that represents a [[natural number]], ''n'', with ''n'' ones followed by a zero (if ''natural number'' is understood as ''non-negative integer'') or with ''n'' − 1 ones followed by a zero (if ''natural number'' is understood as ''strictly positive integer''). For example 5 is represented as 111110 or 11110. Some representations use ''n'' or ''n'' − 1 zeros followed by a one. The ones and zeros are interchangeable [[without loss of generality]]. Unary coding is both a [[prefix-free code]] and a [[self-synchronizing code]].
{| class="wikitable"
! n (non-negative) !! n (strictly positive) !! Unary code !! Alternative
|