def selection_sort(arr):
n = len(arr)
for i in range(n - 1):
min_idx = i
for j in range(i + 1, n):
if arr[j] < arr[min_idx]:
min_idx = j
arr[i], arr[min_idx] = arr[min_idx], arr[i]
print("Lista ordenada:", arr)
lista = [3, 1, 4, 5, 2]
selection_sort(lista)
ZGVmIHNlbGVjdGlvbl9zb3J0KGFycik6CiAgICBuID0gbGVuKGFycikKICAgIGZvciBpIGluIHJhbmdlKG4gLSAxKToKICAgICAgICBtaW5faWR4ID0gaQogICAgICAgIGZvciBqIGluIHJhbmdlKGkgKyAxLCBuKToKICAgICAgICAgICAgaWYgYXJyW2pdIDwgYXJyW21pbl9pZHhdOgogICAgICAgICAgICAgICAgbWluX2lkeCA9IGoKICAgICAgICBhcnJbaV0sIGFyclttaW5faWR4XSA9IGFyclttaW5faWR4XSwgYXJyW2ldCiAgICBwcmludCgiTGlzdGEgb3JkZW5hZGE6IiwgYXJyKQoKbGlzdGEgPSBbMywgMSwgNCwgNSwgMl0Kc2VsZWN0aW9uX3NvcnQobGlzdGEpCg==