单选题

下面的程序是哪种排序?publicclassApp{  publicsta...

发布于 2022-03-03 16:04:44

下面的程序是哪种排序?
public class App {
    public static void main(String[] args) {
        int [] a = {4,2,1,6,3,6,0,-5,1,1}
        int i,j
        int low,high,mid
        int temp
        for(i=1i<10i++){
            temp=a[i]
            low=0
            high=i-1
            while(low<=high){
                mid=(low+high)/2
                if(a[mid]>temp){
                    high=mid-1
                }else{
                    low=mid+1
                }
            }
            for(j=i-1j>highj--){
                a[j+1]= a[j]
                a[high+1] = temp
            }
            for(i=0i<10i++){
                System.out.println(a[i])
            }
        }
    }
}

登录后免费查看答案
关注者
0
被浏览
15
知识点
面圈网VIP题库

面圈网VIP题库全新上线,海量真题题库资源。 90大类考试,超10万份考试真题开放下载啦

去下载看看