To reorder data into a new sequence. The operating system can typically sort file names and text lists. Word processors typically allow lines of text to be reordered, and database programs sort records by one or more fields, often generating a new file. See sorter, counting sort, bubble sort, quick sort and selection sort.
 |
| An Early Sorting Machine |
|---|
| This is a sorter from the Computing-Tabulating-Recording Company in 1917. Punch cards were placed into the hopper and sorted into the respective stackers based on the content of one card column. A 10-digit account number required sorting the cards 10 times. This would have been a great year to buy stock in the company. In 1924, it became IBM. (Image courtesy of International Business Machines Corporation. Unauthorized use not permitted.) |
| 1. | (application, algorithm) | sort - To arrange a collection of items
in some specified order. The items - records in a file or
data structures in memory - consist of one or more fields or
members. One of these fields is designated as the "sort key"
which means the records will be ordered according to the value
of that field. Sometimes a sequence of key fields is
specified such that if all earlier keys are equal then the
later keys will be compared. Within each field some ordering
is imposed, e.g. ascending or descending numerical, lexical ordering, or date.
Sorting is the subject of a great deal of study since it is a
common operation which can consume a lot of computer time.
There are many well-known sorting algorithms with different
time and space behaviour and programming complexity.
Examples are quicksort, insertion sort, bubble sort,
heap sort, and tree sort. These employ many different
data structures to store sorted data, such as arrays,
linked lists, and binary trees. | |
| 2. | (tool) | sort - The Unix utility program for sorting lines of
files.
Unix manual page: sort(1). | |