console.writeline("请输入你要排序的数字,并用,隔开");
string _s=console.readline();
string[] _sArr=_s.split(',');
int _nLength=_sArr.length;
int [] _mArr=new int [_nlength];
for(int i=0;i<_nlength;i++)
{
_sArr[i]=convert.toint32(_mArr[i]);
}
var list=_sArr.tolist();
Quicksort(list,0,_nlength-1);
foreach(var i in list)
{
console.writeline(i.tostring());
}
while(true)
{
Thread.Sleep(10000);//需调用using system.Threading
}
public static int Division(List<int> list,int left,int right)
{
while(left<right)
{
int num=list[left];
if(num>list[left+1])
{
list[left]=list[left+1];
list[left+1]=num;
left++;
}
else
{
int tmp=list[right];
list[right]=list[left+1];
list[left+1]=tmp;
right--;
console.writeline(string.join(",",list));
}
console,writeline("------------- ");
return left;
}
private satic void Quicksort(List<int> list,int left,int right)
{
while(left<right)
int i=Division(list,left,right);
Quicksort(list,i+1,rigth);
Quicksot(list,left,i-1);
}
}