(Tracing Selection Sort): sort
the following list={40,22,95,57,68} using selection sort algorithm.
Fill out the following table for 4 iterations. Show the replacement step for each iteration.
The source code is attached.
list | low | high | if (low< high) | IndexOfmin=low | min=list[low] | i | list[i]<min | min=list[i] | indexOfmin=i; |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |

ablic class RecursiveSelectionSort \{ public static void sort(double[] list) \{ sort(list, 0, list.length - 1); // Sort the entire list \} private static void sort(double[] list, int low, int high) \{ if (low < high) \{ // Find the smallest number and its index in list(low .. high, int indexofmin = low; double min= list [ low ]; for (int i= low +1 ; i<= high; i++ ) \{ if (list [i]<min){ min= list [i]; indexofmin =i; \} \} // Swap the smallest in list(low .. high) with list(low) list [indexofmin] = list [low]; list [ low ]=min; // Sort the remaining list(low+1 .. high) sort(list, low +1 , high); \} \} public static void main(String[] args) \{ double [ ] list ={2,1,3,1,2,5,2,?1,0}; sort(list); for (int i=0;i< list.length; i++ ) System.out.print(list[i] + " "); \}