Insertion sort (2)
Insertion sort algorithm:
To sort a[left…right] into ascending order:
1. For r = left+1, …, right, repeat: 1.1. Let val = a[r]. 1.2. Insert val into its correct sorted position in a[left…r].2. Terminate.
Loop invariant:
Diapositive précédente
Diapositive suivante
Revenir à la première diapositive
Afficher la version graphique