now we shift the sorted players to make room the tallest sorted player moves into the marked player' spotthe next-tallest player into the tallest player' spotand so on when does this shifting process stopimagine that you and the marked player are walking down the line to the left at each position you shift another player to the rightbut you also compare the marked player with the player about to be shifted the shifting process stops when you've shifted the last player that' taller than the marked player the last shift opens up the space where the marked playerwhen insertedwill be in sorted order this is shown in figure figure the insertion sort on baseball players now the partially sorted group is one player biggerand the unsorted group is one player smaller the marker -shirt is moved one space to the rightso it' again in front of the leftmost unsorted player this process is repeated until all the unsorted players have been inserted (hence the name insertion sortinto the appropriate place in the partially sorted group the insertsort workshop applet use the insertsort workshop applet to demonstrate the insertion sort unlike the other sorting appletsit' probably more instructive to begin with random bars rather than sorting bars change to bars with the size buttonand click run to watch the bars sort themselves before your very eyes you'll see that the short red outer arrow marks the dividing line between the partially sorted bars to the left and the unsorted bars to the right the blue inner arrow keeps starting from outer and zipping to the leftlooking for the proper place to insert the marked bar figure shows how this looks when about half the bars are partially sorted the marked bar is stored in the temporary variable pointed to by the magenta arrow at the right end of the graphbut the contents of this variable are replaced so often it' hard to see what' there (unless you slow down to single-step modesorting bars