11 - Codes
Published online by Cambridge University Press: 10 November 2016
Summary
Representing the Data
You have reached the last chapter and it deals with codes, which share some common properties with data structures as auxiliary tools in many algorithms and programs. Studying these codes will also give an opportunity to conclude this work by reviewing some of the data structures introduced in previous chapters.
The purpose of codes is to bridge the communication gap between humans and machines. Our civilization has generated over the years some quite sophisticated natural languages, yet our computers insist on talking only binary, forcing us to translate whatever information we wish to share with a computer, be it a command or a piece of data, into some binary equivalent. This translation is often called an encoding, the translated elements are code words and their set form a code.
In the simplest scenario, the elements to be encoded are just the letters of some alphabet, like ﹛a, b, c, …, y, z﹜, but one may need to encode also infinite sets as the integers ﹛0, 1, 2, …﹜, or letter pairs, or sets of words ﹛the, of, which, …﹜. Ultimately, the set A to be encoded may be of any nature, as long as there is a well defined way to break a given file into a sequence of elements of A. We shall refer to A as an alphabet and call its elements letters or characters, even in the more involved cases, so these terms should not be understood in their restrictive sense.
The choice of a code will be guided by the intended application and expected properties. In many situations, it will be the simplicity of the processing of the code that will be considered as its main advantage, leading to the usage of some standard fixed length code, for which all the code words consist of the same number of bits. One of the popular such codes is the American Standard Code for Information Interchange (ascii), for which each code word is eight bits long, providing for the encoding of 28 = 256 different elements.
- Type
- Chapter
- Information
- Basic Concepts in Data Structures , pp. 178 - 204Publisher: Cambridge University PressPrint publication year: 2016