mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-24 05:21:09 +00:00
15 lines
308 B
Python
15 lines
308 B
Python
|
print ("Enter numbers seprated by comma ")
|
||
|
def selectionsort( aList ):
|
||
|
for i in range( len( aList ) ):
|
||
|
least = i
|
||
|
for k in range( i + 1 , len( aList ) ):
|
||
|
if aList[k] < aList[least]:
|
||
|
least = k
|
||
|
|
||
|
swap( aList, least, i )
|
||
|
|
||
|
def swap( A, x, y ):
|
||
|
tmp = A[x]
|
||
|
A[x] = A[y]
|
||
|
A[y] = tmp
|