Selection Sort

# O(n**2) Time | O(1) space
def selectionSort(array):
    currentIdx = 0 #starting position of the unsorted array

    while currentIdx < len(array) - 1:
        smallestIdx = currentIdx

        for i in range(currentIdx+1,len(array)):
            if array[smallestIdx] > array[i]: # Find the smallest number in the array
                smallestIdx = i
        swap(currentIdx,smallestIdx,array) # Get the smallest number to the start of the array
        currentIdx += 1 # Shift the position of the unsorted array
    return array

def swap(i,j,array): # Function to swap the numbers in the array
    array[i],array[j] = array[j],array[i]
selectionSort([10,6,9,3,6,7,3,2,7,5])
[2, 3, 3, 5, 6, 6, 7, 7, 9, 10]