| | | | | |

Key Comparison Sorts

Theorem. Any comparison sort requires Ω(n log n) comparisons in the worst case.

Proof.

  • Use decision tree for the algorithm
  • Binary tree with node for each comparison, leaf for each solution
  • Each leaf represents a permutation of the input range
  • Sort of a particular data set is represented by a descending path to a leaf
  • Length of this path = number of comparisons made by the sort
  • n! leaves
  • Depth >= log2 n!
  • log2 n! >= Ω(n log n) by Stirlings formula
    See Narrative for elementary proof.

| | Top of Page | 8. Sorting Algorithms - 13 of 16