- 分为负0正这种 且每个区块内无需有序
-
static void sort(int[] x) { int p = 0; int left = 0; int right = x.length-1; while(p<=right){ if(x[p]<0){ int t = x[left]; x[left] = x[p]; x[p] = t; left++; p++; } else if(x[p]>0){ int t = x[right]; x[right] = x[p]; x[p] = t; right--; } else{ p++; } } }
三部排序
最新推荐文章于 2022-03-05 22:38:24 发布