Next: How many comparisons does
Up: Sorting
Previous: Sorting
  Contents
One way of organizing the various sorting algorithms is by
classifying the underlying idea, or `strategy'. Things you might come
up with when asked for such ideas are:
- selection sorting
- Find the smallest item, put it in
the first position, find the smallest of the remaining items, put
it in the second position ...
- insertion sorting
- Take the items one at a time and
insert them into an initially empty data structure such that at
each stage, the data structure we are considering is sorted.
- exchange sorting
- If two items are found to be out of
order, exchange them.
- enumeration sorting
- If we know that there are
items which are smaller than the one we are currently considering
then its final position will be at number
.
- divide and conquer
- This is the recursive approach:
split the problem up into smaller problems. The sorting of just one
item is trivial. In this case, you have to put the sorted `parts'
together somehow.
All these strategies are based on comparing items and then
rearranging them accordingly. We will later consider methods which
make use of specific knowledge about the items that can occur which do
not fall under this category. The ideas given above are also all
based on the assumption that the items to be sorted all fit into the
computer's internal memory, which is why we speak of internal
sorting algorithms. These days, given the growing power of
computers, external storing devices become less and less
frequent in sorting. If not all the items can be stored in the
internal memory at one time, different techniques have to be used. The
underlying idea is to sort however many one can handle at a time and
then carefully merge the results. We will not consider external
sorting algorithms in any detail in this course. You can find some
material on this topic in [Iain T. Adamson Data Structures and
Algorithms: A First Course, Springer 1996] or [Donald E. Knuth,
The Art of Computer Programming: Sorting and Searching,
Addison-Wesley, 1998].
Next: How many comparisons does
Up: Sorting
Previous: Sorting
  Contents
Martin Escardo
2005-01-11