mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-04-29 12:16:14 -04:00
15 lines
318 B
Python
15 lines
318 B
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
def selection_sort(array):
|
|
|
|
for i in range(len(array)):
|
|
min_index = i
|
|
|
|
for j in range(i + 1, len(array)):
|
|
if array[j] < array[min_index]:
|
|
min_index = j
|
|
|
|
array[min_index], array[i] = array[i], array[min_index]
|