Catalog
A sort of permutation , Recursive implementation , The core is to find a value at will , And put the smaller one in front , Bigger ones in the back , Go and look for :
1. Record pivot = arr[i];
2. Find the first less than or equal to from back to front pivot Value , Stop at the low value arr[j] The location of , be pivot Corresponding position arr[i] The value of is replaced by this small value ;
3. Find the first greater than or equal to pivot Value , Stop at high value arr[i] The location of , Then the small value arr[j] By this big value arr[i] replace ;
4. repeat 2 and 3, if i >= j, It means to use pivot The quick sort of this value is finished , And arr[i]=pivot(i It's changing );
5. Recursive interval