Skip to content

Commit ab2106a

Browse files
committed
Added DSA Section - Learning Day -1
1 parent ea10cec commit ab2106a

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

DSA/Shorting.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
def shorting(list):
2+
3+
l = len(list)
4+
5+
for i in range (l):
6+
mini_index = i
7+
8+
for j in range(i+1 , l):
9+
if list[j] < list[mini_index]:
10+
mini_index = j
11+
12+
list[i], list[mini_index] = list[mini_index], list[i]
13+
14+
return list
15+
16+
if __name__ == "__main__":
17+
list = [45,23,56,87,34,29,75]
18+
shorted_list = shorting(list)
19+
print("list is ",shorted_list)

0 commit comments

Comments
 (0)