参考源:http://www.cnblogs.com/morewindows/archive/2011/08/13/2137415.html __author__ = 'root'arr_in = [72, 6, 57, 88, 60, 42, 83, 73, 48, 85]def sort(start, end): if end - start < 0: return i = start j = end x = arr_in[i] while i < j: while i < j and arr_in[j] >= x: j -= 1 if i < j: arr_in[i] = arr_in[j] i += 1 while i < j and arr_in[i] < x: i += 1 if i < j: arr_in[j] = arr_in[i] j -= 1 arr_in[i] = x print arr_in sort(start, i - 1) sort(i + 1, end)sort(0, len(arr_in) - 1)print arr_in
#includevoid quick_sort(int s[], int l, int r){ if(l < r) { int i = AdjustArray(s, l, r); quick_sort(s, l, i-1); quick_sort(s, i+1, r); }}int AdjustArray(int s[], int l, int r){ int i = l, j = r; int x = s[l]; while(i < j) { while(i < j && s[j] >= x) j --; if(i < j) { s[i] = s[j]; i ++; } while(i < j && s[i] < x) i++; if(i