insertion sort is commonly used as part of quicksort implementation the example programs in this build on the array classes we developed in the last the sorting algorithms are implemented as methods of similar array classes be sure to try out the workshop applets included in this they are more effective in explaining how the sorting algorithms work than prose and static pictures could ever be how would you do itimagine that your kids-league baseball team (mentioned in "overview,"is lined up on the fieldas shown in figure the regulation nine playersplus an extrahave shown up for practice you want to arrange the players in order of increasing height (with the shortest player on the left)for the team picture how would you go about this sorting processas human beingyou have advantages over computer program you can see all the kids at onceand you can pick out the tallest kid almost instantlyyou don' need to laboriously measure and compare everyone alsothe kids don' need to occupy particular places they can jostle each otherpush each other little to make roomand stand behind or in front of each other after some ad hoc rearrangingyou would have no trouble in lining up all the kidsas shown in figure computer program isn' able to glance over the data in this way it can only compare two players at oncebecause that' how the comparison operators work this tunnel vision on the part of algorithms will be recurring theme things may seem simple to us humansbut the algorithm can' see the big picture and mustthereforeconcentrate on the details and follow some simple rules the three algorithms in this all involve two stepsexecuted over and over until the data is sorted compare two items swap two items or copy one item howevereach algorithm handles the details in different way figure the unordered baseball team