This repository has been archived on 2021-10-31. You can view files and clone it, but cannot push or open issues or pull requests.
DSA/selection.py
2019-03-25 15:21:57 +01:00

18 lines
369 B
Python
Executable file

#!/usr/bin/env python3
import sys
def selectionsort(A):
if len(A) < 2:
return A
for i in range(len(A)):
for j in range(i + 1, len(A)):
if A[i] > A[j]:
A[i], A[j] = A[j], A[i]
print(A)
return A
if __name__ == "__main__":
args = [int(x) for x in sys.argv[1:]]
print(selectionsort(args))