Skip to content

Instantly share code, notes, and snippets.

@pysoftware
Created February 14, 2019 18:13
Show Gist options
  • Save pysoftware/ea6e5f595cfef945548cb0e90a37d787 to your computer and use it in GitHub Desktop.
Save pysoftware/ea6e5f595cfef945548cb0e90a37d787 to your computer and use it in GitHub Desktop.
Selection sort/ Сортировка выбором
# Selection sort alghorirm
# Алгоритм сортировки выбором
a = [3, 5, 1, 0, 2, 8]
for j in range(1,len(a)):
i = j-1
while i >= 0 and a[i] > a[i+1]:
a[i], a[i+1] = a[i+1], a[i]
i -= 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment