Algorithms and Data Structures/Coding Practices

AlgoExpert Selection Sort

brightlightkim 2022. 7. 19. 13:10

def selectionSort(array):
    for i in range(len(array)):
        min = i
        for j in range(i, len(array)):
            if array[j] < array[min]:
                min = j
        tmp = array[i]
        array[i] = array[min]
        array[min] = tmp
                
    return array