📌  相关文章
📜  Python 站点中的快速排序:stackoverflow.com - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:54.137000             🧑  作者: Mango

代码示例1
def sort(array=[12,4,5,6,7,3,1,15]):
    less = []
    equal = []
    greater = []

    if len(array) > 1:
        pivot = array[0]
        for x in array:
            if x < pivot:
                less.append(x)
            if x == pivot:
                equal.append(x)
            if x > pivot:
                greater.append(x)
            sort(less)
            sort(pivot)
            sort(greater)