a={77,5,332,1,3}local low,hight,i,jfunction q(low,hight) local key=a[low] i=low j=hight if(i>=j)then return end while(i<j)do while(i<j and a[j]>key)do j=j-1; end if(i<j)then a[i]=a[j] i=i+1 end while (i<j and a[i]<key)do i=i+1 end if(i<j)then a[j]=a[i] j=j-1; end end a[i]=key q(low,i) q(i+1,hight) endq(1,5)PRint(a[1].." ",a[2].." ",a[3].." ",a[4].." ",a[5])这个思路。。就是快排的思路。改成lua代码就好了。。分小块来排序
新闻热点
疑难解答