This article is about collation in library, information, and computer science. Collation is the assembly of written information into a standard order. Many systems of collation are based on numerical order or alphabetical order, or extensions and combinations the letters of the alphabet numbered. Collation differs from classification in that classification is concerned with arranging information into logical categories, while collation is concerned with the ordering of items of information, usually based on the form of their identifiers.
A collation algorithm such as the Unicode collation algorithm defines an order through the process of comparing two given character strings and deciding which should come before the other. The main advantage of collation is that it makes it fast and easy for a user to find an element in the list, or to confirm that it is absent from the list. Strings representing numbers may be sorted based on the values of the numbers that they represent. A similar approach may be taken with strings representing dates or other items that can be ordered chronologically or in some other natural fashion. Alphabetical order is the basis for many systems of collation where items of information are identified by strings consisting principally of letters from an alphabet.
The ordering of the strings relies on the existence of a standard ordering for the letters of the alphabet in question. To decide which of two strings comes first in alphabetical order, initially their first letters are compared. The string whose first letter appears earlier in the alphabet comes first in alphabetical order. If the first letters are the same, then the second letters are compared, and so on, until the order is decided.
Capital letters are typically treated as equivalent to their corresponding lowercase letters. For alternative treatments in computerized systems, see Automated collation, below. When strings contain spaces or other word dividers, the decision must be taken whether to ignore these dividers or to treat them as symbols preceding all other letters of the alphabet. Abbreviations may be treated as if they were spelt out in full. There is also a traditional convention in English that surnames beginning Mc and M’ are listed as if those prefixes were written Mac.
Strings that represent personal names will often be listed by alphabetical order of surname, even if the given name comes first. For example, Juan Hernandes and Brian O’Leary should be sorted as “Hernandes, Juan” and “O’Leary, Brian” even if they are not written this way. Very common initial words, such as The in English, are often ignored for sorting purposes. So The Shining would be sorted as just “Shining” or “Shining, The”. Sometimes such characters are treated as if they came before or after all the letters of the alphabet. Languages have different conventions for treating modified letters and certain letter combinations.