chap internal sorting = figure an example of selection sort each column shows the array after the iteration with the indicated value of in the outer for loop numbers above the line in each column have been sorted and are in their final positions key key key key key key key key ( (bfigure an example of swapping pointers to records (aa series of four records the record with key value comes before the record with key value (bthe four records after the top two pointers have been swapped now the record with key value comes before the record with key value remember the position of the element to be selected and do one swap at the end thusthe number of comparisons is still th( )but the number of swaps is much less than that required by bubble sort selection sort is particularly advantageous when the cost to do swap is highfor examplewhen the elements are long strings or other large records selection sort is more efficient than bubble sort (by constant factorin most other situations as well there is another approach to keeping the cost of swapping records low that can be used by any sorting algorithm even when the records are large this is to have each element of the array store pointer to record rather than store the record itself in this implementationa swap operation need only exchange the pointer valuesthe records themselves do not move this technique is illustrated by figure additional space is needed to store the pointersbut the return is faster swap operation