Skip to content

Commit 55477ca

Browse files
committed
Added Shell Sort
1 parent 4a9319f commit 55477ca

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

ShellSort.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
def shellSort(inpList):
2+
3+
gap = len(inpList) // 2
4+
while gap > 0:
5+
6+
for i in range(gap, len(inpList)):
7+
temp = inpList[i]
8+
j = i
9+
10+
while j >= gap and inpList[j - gap] > temp:
11+
inpList[j] = inpList[j - gap]
12+
j = j-gap
13+
inpList[j] = temp
14+
15+
gap = gap//2
16+
17+

0 commit comments

Comments
 (0)