Skip to content

Commit ab63cf5

Browse files
authored
Merge pull request powerexploit#3 from rcsm89/master
Create insert_sort.py
2 parents 74cd41c + b497949 commit ab63cf5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Scripts/insert_sort.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
def insert_sort(_list):
2+
for i in range(1, len(_list)):
3+
elm = _list[i]
4+
k = i
5+
while not k <= 0 and _list[k - 1] > elm :
6+
_list[k] = _list[k - 1]
7+
k -= 1
8+
_list[k] = elm
9+
l = _list
10+
return l

0 commit comments

Comments
 (0)