Fastest way to sort in Python

后端 未结 9 2097
太阳男子
太阳男子 2021-02-13 02:56

What is the fastest way to sort an array of whole integers bigger than 0 and less than 100000 in Python? But not using the built in functions like sort.

Im looking at th

9条回答
  •  走了就别回头了
    2021-02-13 03:21

    def sort(l):
        p = 0
        while(pl[p+1]):
                l[p],l[p+1] = l[p+1],l[p]
                if(not(p==0)):
                    p = p-1
            else:
                p += 1
        return l
    

    this is a algorithm that I created but is really fast. just do sort(l) l being the list that you want to sort.

提交回复
热议问题