user
Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.

### Instruction:
Create an algorithm that sorts a given array in ascending order.

### Input:
[4, 5, 2, 1, 3]

### Response:
assistant
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