# 【蓝桥杯】_06三部排序

package java2013B;

/**
* @Author bennyrhys
* @Date 2020-03-11 23:06

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{
_________________________;  //代码填空位置
}
}
}

25,18,-2,0,16,-5,33,21,0,19,-16,25,-3,0

-3,-2,-16,-5,0,0,0,21,19,33,25,16,18,25

*/
public class _06三部排序 {
public static void main(String[] args) {
int arr[] = {25,18,-2,0,16,-5,33,21,0,19,-16,25,-3,0};
sort(arr);
for (int i = 0; i < arr.length; i++) {
System.out.print(arr[i]+" ");
}
}
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++;  //代码填空位置
}
}
}
}

# 文末福利

1. 通过公众号提示的关键字可以领取竞赛资料。但是，有时候会失效，小伙伴可以在后台留言提醒我修复。
2. 最后一波分享一些很有意义的开源干货

SpringBoot两小时快速入门，极客表白浪漫红包程序
https://github.com/bennyrhys/LuckyMoney-SpringBootProject
SpringBoot两小时快速入门，基因芯片个人信息程序
https://github.com/bennyrhys/Girl-SpringBootProject
SpringBoot之web进阶，人类基因芯片程序-提升篇
https://github.com/bennyrhys/GirlPlus-SpringBootProject

+ 订阅