Skip to content

Commit 528ae13

Browse files
authored
Python
1 parent 28de835 commit 528ae13

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Shell Sort/shell_sort.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
def ShellSort(arr):
2+
h = len(arr) // 2
3+
while h > 0:
4+
for i in range(h, len(arr)):
5+
t = arr[i]
6+
j = i
7+
while j >= h and arr[j - h] > t:
8+
arr[j] = arr[j - h]
9+
j -= h
10+
arr[j] = t
11+
h = h // 2
12+
return arr

0 commit comments

Comments
 (0)