Prev Up Next
Go backward to 3.14 Generic Divide-and-Conquer Sequence Algorithm
Go up to 3 An Example of Concept Webs: Programming Concepts
Go forward to 3.16 Generic Search Algorithm

3.15 Generic Sorting Algorithm

A generic sorting algorithm is a generic sequence algorithm whose input-output relation is specialized to the relation that the input is a finite sequence of values and the output is a permutation of the input and is ordered according to some criterion.

The requirement of "ordered according to some criterion" is an example of the indefiniteness that makes the algorithm generic. We cannot obtain a nongeneric algorithm until we specify a particular ordering relation on the values. However, we can (and should, to ensure the algorithm has a generic implementation) put certain requirements on the ordering relation. Usually the requirement is stated that it must be a total order, but the least restrictive requirement is what is called a "strict-weak-order." (These terms should have links into a concept web that defines various concepts of order relations.)


musser@cs.rpi.edu

Prev Up Next