Introduction to Insertion Sort
With insertion sort, you move an element that’s not in the right position all the way to the point where it should be. (Reading time: 2 minutes)
The current element stays the current element after swapping, until it is in the right position! The element then gets “inserted” before all the elements that are greater than it, and after the element that is smaller than it.
Get hands-on with 1400+ tech skills courses.