A sorting algorithm to sort an array A[0…n-1] of n elements in ascending order:

1. For i = 0 to n-2
2. Set min = i
3. For j = i+1 to n-1
4.  If A[j] < A[min], set min = j
5.  Exchange elements A[i] and A[min]
6. End loop
7. End loop
[4, 5, 2, 1, 3]
Crea un algoritmo che ordina un determinato array in ordine crescente.