as you single-step through the algorithmyou'll notice that the explanation we gave in the last section is slightly simplified the sequence for the -sort is not actually ( , , )( , , )( , )and ( , instead the first two elements of each group of three are sorted firstthen the first two elements of the second groupand so on once the first two elements of all the groups are sortedthe algorithm returns and sorts three-element groups the actual sequence is ( , )( , )( , )( , )( , , )( , , it might seem more obvious for the algorithm to -sort each complete subarray first( , )( , , )( , )( , , )( , )( , )but the algorithm handles the array indices more efficiently using the first scheme the shellsort is actually not very efficient with only itemsmaking almost as many swaps and comparisons as the insertion sort howeverwith bars the improvement becomes significant it' instructive to run the workshop applet starting with inversely sorted bars (remember thatas in the first press of new creates random sequence of barswhile the second press creates an inversely sorted sequence figure shows how this looks after the first passwhen the array has been completely -sorted figure shows the situation after the next passwhen it is -sorted with each new value of hthe array becomes more nearly sorted figure after the -sort figure after the -sort