figure bubble sortend of 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 again you 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 this is all much harder to describe than it is to demonstrateso 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 the run button this is two-speed graphyou can either let it run by itself or you can single-step through the process to get quick idea of what happensclick the run button the algorithm will bubble sort the bars when it finishesin seconds or sothe bars will be sortedas