发布时间:2019-07-15 10:48:02编辑:auto阅读(1755)
def sortList(alist):
alen = len(alist)
if alen == 0:
return alist
if alen > 0:
aitem = alist[alen / 2]
aleftlist = []
arightlist = []
for i in range(0,alen):
afirstitem = alist[i]
if i <> alen / 2:
if afirstitem > aitem:
arightlist.append(afirstitem)
else:
aleftlist.append(afirstitem)
aleftlist = sortList(aleftlist)
arightlist = sortList(arightlist)
aleftlist.append(aitem)
return aleftlist + arightlist
alist = [0,1,2]
print(sortList(alist))
上一篇: Python运算符说明
下一篇: python学习之异常处理
47481
45784
36781
34306
28953
25588
24433
19605
19094
17624
5457°
6039°
5555°
5630°
6556°
5368°
5369°
5874°
5849°
7161°