标签:class code turn 快速 模板 while span max int
1 int n; 2 int a[MAX_N]; 3 4 void Quick_Sort(int lt, int rt) 5 { 6 int key = a[lt + rt >> 1]; 7 int i = lt, j = rt; 8 while(i < j) 9 { 10 while(a[i] < key) ++i; 11 while(a[j] > key) --j; 12 if(i <= j) swap(a[i], a[j]), ++i, --j; 13 } 14 if(lt < j) Quick_Sort(lt, j); 15 if(i < rt) Quick_Sort(i, rt); 16 return; 17 }
标签:class code turn 快速 模板 while span max int
原文地址:https://www.cnblogs.com/kcn999/p/10015315.html