[prev] 27 [next]

Insertion Sort

Simple adaptive method:
  • take first element and treat as sorted array (length 1)
  • take next element and insert into sorted part of array
    so that order is preserved
  • above increases length of sorted part by one
  • repeat until whole array is sorted