sorting


Summary

Concept

Insertion sort

  • Sort tail recursively, insert head into sorted tail

Selection sort

  • Remove the smallest, sort the rest recursively

Merge sort

  • Split in half, sort each half recursively

Quick sort

  • Choose a random pivot, split into values larger and smaller than pivot, sort each set recursively

Application