6.Sorting§
- Each record contains a field called the key.
- Linear order: comparison.
- Measures of cost:
- Comparisons
- Swaps
What would you do if you have a stack of phone bills from the past two years and you want to order by date? A fairly natural way to handle this is to look at the first two bills and put them in order. Then take the third bill and put it into the right position with respect to the first two, and so on.
Consider this start to the process.