“`”

<pre><code class=""language-php"" lang=""php"">#快速排序:最快的n*logN
def qiuckSort(list):
if len(list)<2:
return list
mid = list[0]
left = [i for i in list[1:] if i <= mid]
right = [i for i in list[1:] if i mid]
finallyList = qiuckSort(left)+[mid] + qiuckSort(right)
return finallyList
array = [3, 0, 1, 832,23,45, 5, 5, 6,46, 9, 56, 897]
print(qiuckSort(array)[-4:])
</code></pre>

<pre><code> "“`

Was this helpful?

0 / 0

发表回复 0

Your email address will not be published.