Sorting algorithms aren't usually tested alone. They are often paired with another problem type and the goal is to really see if you're able to think about the algorithms in a wider context

  • Traverse from left to right, swap element with neighbor is neighbor is less than element

  • Repeat till no more swaps are needed

  • Invariant: after every iteration, the largest elements are arranged at the end in ascending order

Last updated