# Code

 related topics {math, number, function} {system, computer, user} {language, word, form} {company, market, business} {theory, work, human} {work, book, publish} {specie, animal, plant}

A code is a rule for converting a piece of information (for example, a letter, word, phrase, or gesture) into another form or representation (one sign into another sign), not necessarily of the same type.

In communications and information processing, encoding is the process by which information from a source is converted into symbols to be communicated. Decoding is the reverse process, converting these code symbols back into information understandable by a receiver.

One reason for coding is to enable communication in places where ordinary spoken or written language is difficult or impossible. For example, semaphore, where the configuration of flags held signaller or the arms of a semaphore tower encodes parts of the message, typically individual letters and numbers. Another person standing a great distance away can interpret the flags and reproduce the words sent.

## Contents

### Theory

In information theory and computer science, a code is usually considered as an algorithm which uniquely represents symbols from some source alphabet, by encoded strings, which may be in some other target alphabet. An extension of the code for representing sequences of symbols over the source alphabet is obtained by concatenating the encoded strings.

Before giving a mathematically precise definition, we give a brief example. The mapping

is a code, whose source alphabet is the set {a,b,c} and whose target alphabet is the set {0,1}. Using the extension of the code, the encoded string 0011001011 can be grouped into codewords as 0 – 011 – 0 – 01 – 011, and these in turn can be decoded to the sequence of source symbols acabc.