Page 175 - Algorithms Notes for Professionals
P. 175

minIndex = i
            minValue = list[i]
            for j from i+1 to n
                if list[j] < minValue
                    minIndex = j
                    minValue = list[j]
            swap list[i] and list[minIndex]
        return list[k]


       Visualization of selection sort:






























       Example of Selection sort:

















































       colegiohispanomexicano.net – Algorithms Notes                                                            171
   170   171   172   173   174   175   176   177   178   179   180