Article From:https://www.cnblogs.com/sea-stream/p/9689039.html
def shell_sort(slist):

    gap = len(slist)

    while gap > 1:

        gap = gap // 2

        for i in range(gap, len(slist)):

            for j in range(i % gap, i, gap):

                if slist[i] < slist[j]:

                    slist[i], slist[j] = slist[j], slist[i]

    return slist

 

slist = shell_sort([4,5,6,7,3,2,6,9,8])

print(slist)

  

Link of this Article: Python Hill sorting

Leave a Reply

Your email address will not be published. Required fields are marked *