Insertion Sort

Insertion Sort Animation

 

Insertion Sort Infographic

 

Methodology

  1. Left swap repeatedly first number in unsorted space until

    • the first number is greater than number on its left

    • the first number has no left number

  2. Reduce the unsorted space

  3. Repeat (1) and (2) until the unsorted space is empty

Complexity

Time Complexity: N^2
Space Complexity: 1
Stable


Previous
Previous

Bubble Sort

Next
Next

Selection Sort