Write an algorithm that sorts an array of integers
Here is one way of sorting an array of integers using the "Insertion Sort" algorithm:

1. Begin by assuming that the first element of the array is already sorted.
2. Then, iterate through the array, starting from the second element (index 1).
3. For each element, compare it to the elements before it in the array.
4. If the current element is smaller than the previous element, swap their positions.
5. Continue swapping the current element with the previous element until it is in the correct position (i.e., it is greater than or equal to the element before it and less than or equal to the element after it).
6. Repeat this process for all elements in the array until the whole array is sorted in ascending order.
7. Return the sorted array.

Here is an example implementation of the above algorithm in Python:

```
def insertion_sort(arr):
    for i in range(1, len(arr)):
        j = i
        while j > 0 and arr[j-1] > arr[j]:
            arr[j-1], arr[j] = arr[j], arr[j-1]
            j -= 1
    return arr
```

This algorithm sorts the array in-place, meaning it does not use any additional storage space. The time complexity of this algorithm is O(n^2) in the worst case, where n is the number of elements in the array.
Below is an instruction that describes a task, write a response that appropriately completes the request.

### Instruction:
Write an algorithm that sorts an array of integers

### Response:
Here is one way of sorting an array of integers using the "Insertion Sort" algorithm:

1. Begin by assuming that the first element of the array is already sorted.
2. Then, iterate through the array, starting from the second element (index 1).
3. For each element, compare it to the elements before it in the array.
4. If the current element is smaller than the previous element, swap their positions.
5. Continue swapping the current element with the previous element until it is in the correct position (i.e., it is greater than or equal to the element before it and less than or equal to the element after it).
6. Repeat this process for all elements in the array until the whole array is sorted in ascending order.
7. Return the sorted array.

Here is an example implementation of the above algorithm in Python:

```
def insertion_sort(arr):
    for i in range(1, len(arr)):
        j = i
        while j > 0 and arr[j-1] > arr[j]:
            arr[j-1], arr[j] = arr[j], arr[j-1]
            j -= 1
    return arr
```

This algorithm sorts the array in-place, meaning it does not use any additional storage space. The time complexity of this algorithm is O(n^2) in the worst case, where n is the number of elements in the array.