Goes over unsorted part of the array and inserts each next element into its sorted position in the sorted part