selection sort typically executes faster in benchmark studies in factfor our listthe bubble sort makes exchangeswhile the selection sort makes only self check suppose you have the following list of numbers to sort[ which list represents the partially sorted list after three complete passes of selection sort [ [ [ [ the insertion sort the insertion sortalthough still ( )works in slightly different way it always maintains sorted sublist in the lower positions of the list each new item is then "insertedback into the previous sublist such that the sorted sublist is one item larger figure shows the insertion sorting process the shaded items represent the ordered sublists as the algorithm makes each pass we begin by assuming that list with one item (position is already sorted on each passone for each item through the current item is checked against those in the already sorted sublist as we look back into the already sorted sublistwe shift those items that are greater to the right when we reach smaller item or the end of the sublistthe current item can be inserted figure shows the fifth pass in detail at this point in the algorithma sorted sublist of five items consisting of and exists we want to insert back into the already sorted items the first comparison against causes to be shifted to the right and are also shifted when the item is encounteredthe shifting process stops and is placed in the open position now we have sorted sublist of six items the implementation of insertion_sort shows that there are again passes to sort items the iteration starts at position and moves through position as these are the items that need to be inserted back into the sorted sublists line performs the shift operation that moves value up one position in the listmaking room behind it for the insertion remember that this is not complete exchange as was performed in the previous algorithms the maximum number of comparisons for an insertion sort is the sum of the first - integers againthis is ( howeverin the best caseonly one comparison needs to be done on each pass this would be the case for an already sorted list one note about shifting versus exchanging is also important in generala shift operation requires approximately third of the processing work of an exchange since only one assignment is performed in benchmark studiesinsertion sort will show very good performance sorting