the output from selectsort java is identical to that from bubblesort java invariant in the selectsort java programthe data items with indices less than or equal to out are always sorted efficiency of the selection sort the selection sort performs the same number of comparisons as the bubble sortn*( - )/ for data itemsthis is comparisons however items require fewer than swaps with items , comparisons are requiredbut fewer than swaps for large values of nthe comparison times will dominateso we would have to say that the selection sort runs in ( timejust as the bubble sort did howeverit is unquestionably faster because there are so few swaps for smaller values of nthe selection sort may in fact be considerably fasterespecially if the swap times are much larger than the comparison times insertion sort in most cases the insertion sort is the best of the elementary sorts described in this it still executes in ( timebut it' about twice as fast as the bubble sort and somewhat faster than the selection sort in normal situations it' also not too complexalthough it' slightly more involved than the bubble and selection sorts it' often used as the final stage of more sophisticated sortssuch as quicksort insertion sort on the baseball players to begin the insertion sortstart with your baseball players lined up in random order (they wanted to play gamebut clearly there' no time for that it' easier to think about the insertion sort if we begin in the middle of the processwhen the team is half sorted partial sorting at this point there' an imaginary marker somewhere in the middle of the line (maybe you threw red -shirt on the ground in front of player the players to the left of this marker are partially sorted this means that they are sorted among themselveseach one is taller than the person to his or her left howeverthe players aren' necessarily in their final positions because they may still need to be moved when previously unsorted players are inserted between them