Skip to content

Commit

Permalink
Merge pull request #53 from savarbhasin/patch-1
Browse files Browse the repository at this point in the history
Create selectionsort.py
  • Loading branch information
fineanmol authored Oct 8, 2020
2 parents 452a1bd + 7203820 commit 189066c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions selectionsort.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
def selection_sort(lst):
min_no = 0
n = 0
while n < len(lst):

for i in range(n , len(lst)-1):

if lst[min_no] > lst[i+1]:
min_no = i+1

lst[n], lst[min_no] = lst[min_no], lst[n]

n+=1
min_no = n

print(lst)

0 comments on commit 189066c

Please sign in to comment.