Selection sort (2)
Selection sort algorithm:
To sort a[left…right] into ascending order:
1. For l = left, …, right–1, repeat: 1.1. Set p such that a[p] is the least of a[l…right]. 1.2. If p ? l, swap a[p] and a[l].2. Terminate.
Loop invariant:
Diapositive précédente
Diapositive suivante
Revenir à la première diapositive
Afficher la version graphique