Linear search (1)
Linear search algorithm:
To find which (if any) component of a[left…right] equals target:
1. For p = left, …, right, repeat: 1.1. If target equals a[p], terminate with answer p.2. Terminate with answer none.
Loop invariant:
Diapositive précédente
Diapositive suivante
Revenir à la première diapositive
Afficher la version graphique