you continue down the line this way until you reach the right end you have by no means finished sorting the kidsbut you do know that the tallest kid is on the right this must be true becauseas soon as you encounter the tallest kidyou'll end up swapping him (or herevery time you compare two kidsuntil eventually he (or shewill reach the right end of the line this is why it' called the bubble sortas the algorithm progressesthe biggest items "bubble upto the top end of the array figure shows the baseball players at the end of the first pass sorted figure bubble sortthe end of the first pass after this first pass through all the datayou've made - comparisons and somewhere between and - swapsdepending on the initial arrangement of the players the item at the end of the array is sorted and won' be moved again now you go back and start another pass from the left end of the line againyou go toward the rightcomparing and swapping when appropriate howeverthis time you can stop one player short of the end of the lineat position - because you know the last positionat - already contains the tallest player this rule could be stated as when you reach the first sorted playerstart over at the left end of the line you continue this process until all the players are in order describing this process is much harder than demonstrating itso let' watch the bubblesort workshop applet at work the bubblesort workshop applet start the bubblesort workshop applet you'll see something that looks like bar graphwith the bar heights randomly arrangedas shown in figure