Skip to content

Instantly share code, notes, and snippets.

@tuvo1106
Created July 4, 2019 17:19
Show Gist options
  • Save tuvo1106/7f9fbc5e7e1645ff53c53ba82746bd1e to your computer and use it in GitHub Desktop.
Save tuvo1106/7f9fbc5e7e1645ff53c53ba82746bd1e to your computer and use it in GitHub Desktop.
def shell(l:list):
arr = l[::]
n = 0
while (n < len(arr) // 3):
n = n * 3 + 1
while (n > 0):
for i in range(int(n), len(arr)):
tmp = arr[i]
j = i
while j >= n and arr[j - n] > tmp:
arr[j] = arr[j-n]
j -= n
arr[j] = tmp
n = (n - 1) // 3
return arr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment