python 算法 快速排序
# -*- coding: utf-8 -*-
from random import randint, shuffle
def _partition(seq, p, r):
“””数组划分,伪码如下:
partition(a, p, r)
1 x ← a[r] // 作为划分主元
2 i ← p-1
3 for j ← p to r-1
4 do if a[j]
A programmer’s note boke for work and life
python 算法 快速排序
# -*- coding: utf-8 -*-
from random import randint, shuffle
def _partition(seq, p, r):
“””数组划分,伪码如下:
partition(a, p, r)
1 x ← a[r] // 作为划分主元
2 i ← p-1
3 for j ← p to r-1
4 do if a[j]