When to use

  1. Problems involving arrays containing numbers in a given range and need to sort them
  2. If the problem asks you to find the missing/duplicate/smallest number in an sorted/rotated array

Mechanism

  1. Iterate over the array one number at a time
  2. If the current number you are iterating is not at the correct index
    1. Swap it with the number at its correct index