Here is a Python function that implements the sort algorithm:

```python
def sort_alogithm(arr):
    """
    Sorts the given array in ascending order using the merge sort algorithm.
    """
    if len(arr) <= 1:
        return arr

    mid = len(arr) // 2
    left = arr[:mid]
    right = arr[mid:]

    left = merge_sort(left)
    right = merge_sort(right)

    return merge(left, right)

def merge(left, right):
    """
    Merges two sorted arrays into a single sorted array.
    """
    result = []
    i, j = 0, 0

    while i < len(left) and j < len(right):
        if left[i] <= right[j]:
            result.append(left[i])
            i += 1
        else:
            result.append(right[j])
            j += 1

    result += left[i:]
    result += right[j:]

    return result
```

The `sort_alogithm` function takes an array as input and returns a sorted array. It first checks if the array is empty or has only one element. If it is, it simply returns the array. Otherwise, it performs a quick sort on the left and right halves of the array using the merge sort algorithm. The merge sort algorithm