« Programmation algorithmique/Tris » : différence entre les versions

Contenu supprimé Contenu ajouté
Ligne 49 :
 
 
FONCTION Partitionner (A: tableau [1..n] d’entiers, p:entier, r: entier):entier
Var: x, i, j, temp: entier
bool: booleen
début
x= A[p]
i= p-1
j= r+1
bool= vrai
tant que (bool) faire
répéter j= j-1 jusqu'à A[j] <=x
répéter i= i+1 jusqu'à A[i] >=x
bool= faux
si i < j alors
temp= A[i]
A[i]= A[j]
A[j]= temp
bool= vrai
Sinon
Retourner j
fsi
ftq
Fin