标签:style pre quick span tor -- quic pos art
int partition(vector<int>&arr, int begin, int end) { int pivot = arr[begin]; while(begin < end) { while(begin < end && arr[--end] >= pivot); arr[begin] = arr[end]; while(begin < end && arr[++begin] <= pivot); arr[end] = arr[begin]; } arr[begin] = pivot; return begin; } void quick_sort(vector<int> &arr, int begin, int end){ if(begin >= end - 1){ return; } int pos = partition(arr, begin, end); quick_sort(arr, begin, pos); quick_sort(arr, pos+1, end); }
标签:style pre quick span tor -- quic pos art
原文地址:https://www.cnblogs.com/sclczk/p/10972711.html