won' need to be moved again notice that in this algorithm the sorted players accumulate on the left (lower indices)while in the bubble sort they accumulated on the right the next time you pass down the row of playersyou start at position andfinding the minimumswap with position this continues until all the players are sorted more detailed description in more detailstart at the left end of the line of players record the leftmost player' height in your notebook and throw the magenta towel on the ground in front of this person then compare the height of the next player to the right with the height in your notebook if this player is shortercross out the height of the first playerand record the second player' height instead also move the towelplacing it in front of this new "shortest(for the time beingplayer continue down the rowcomparing each player with the minimum change the minimum value in your notebookand move the towelwhenever you find shorter player when you're donethe magenta towel will be in front of the shortest player swap this shortest player with the player on the left end of the line you've now sorted one player you've made - comparisonsbut only one swap on the next passyou do exactly the same thingexcept that you can completely ignore the player on the leftbecause this player has already been sorted thus the algorithm starts the second pass at position instead of with each succeeding passone more player is sorted and placed on the leftand one less player needs to be considered when finding the new minimum figure shows how this looks for the first three passes the selectsort workshop applet to see how the selection sort looks in actiontry out the selectsort workshop applet the buttons operate the same way as those in the bubblesort applet use new to create new array of randomly arranged bars the red arrow called outer starts on the leftit points to the leftmost unsorted bar gradually it will move right as more bars are added to the sorted group on its left the magenta min arrow also starts out pointing to the leftmost barit will move to record the shortest bar found so far (the magenta min arrow corresponds to the towel in the baseball analogy the blue inner arrow marks the bar currently being compared with the minimum as you repeatedly press stepinner moves from left to rightexamining each bar in turn and comparing it with the bar pointed to by min if the inner bar is shortermin jumps over to this newshorter bar when inner reaches the right end of the graphmin points to the shortest of the unsorted bars this bar is then swapped with outerthe leftmost unsorted bar figure shows the situation midway through sort the bars to the left of outer are sortedand inner has scanned from outer to the right endlooking for the shortest bar the min arrow has recorded the position of this barwhich will be swapped with outer use the size button to switch to barsand sort random arrangement you'll see how the magenta min arrow hangs out with perspective minimum value for whileand then jumps to new one when the blue inner arrow finds smaller candidate the red outer arrow moves slowly but inexorably to the rightas the sorted bars accumulate to its left