works its way to the front after finding the proper positionthe item is inserted figure illustrates the application of this algorithm on an array of integer values the insertion sort is an example of sorting algorithm in which the best and worst cases are different determining the different cases and the corresponding run times is left as an exercise figure result of applying the insertion sort algorithm to the sample array the gray boxes show values that have been sortedthe black boxes show the next value to be positionedand the lighter gray boxes with black text are the sorted values that have to be shifted to the right to open spot for the next value