Skip to content

Commit ac59b42

Browse files
authored
Add files via upload
1 parent 37442f5 commit ac59b42

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

InsertionSort.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import random
2+
a=[]
3+
n=int(input())
4+
for i in range (n):
5+
a.append(random.randint(0,200))
6+
for i in range(1,n):
7+
key=a[i]
8+
j=i-1
9+
10+
while j>=0 and key<a[j]:
11+
a[j],a[j+1]=a[j+1],a[j]
12+
j=j-1
13+
14+
print(a)

0 commit comments

Comments
 (0)