The sort-by-exchange method for a linked list consists of comparing consecutive links between items and then making a physical exchange if a link is out of place. After the last 2 links on the list have been compared, the process begins again at the head of the list, terminating only when no further exchanges are needed. This procedure applies for ordering relatively short lists (short enough to be contained in directly accessible memory) on which a few links are out of sequence.
展开▼