summaryrefslogtreecommitdiff
path: root/progs/a791.py
diff options
context:
space:
mode:
Diffstat (limited to 'progs/a791.py')
-rw-r--r--progs/a791.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/progs/a791.py b/progs/a791.py
new file mode 100644
index 0000000..d92ed2e
--- /dev/null
+++ b/progs/a791.py
@@ -0,0 +1,13 @@
+def shell_sort(my_list):
+ gap = len(my_list) // 2
+ while gap > 0:
+ for i in range(gap, len(my_list)):
+ current_item = my_list[i]
+ j = i
+ while j >= gap and my_list[j - gap] > current_item:
+ my_list[j] = my_list[j - gap]
+ j -= gap
+ my_list[j] = current_item
+ gap //= 2
+
+ return my_list \ No newline at end of file