亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

這段quick排序哪里錯了?求助。

這段quick排序哪里錯了?求助。

比較小的小吉他 2016-10-22 21:12:10
import?java.util.Scanner; public?class?QuickSort?{ ????public?static?int[]?QuickSort1(int[]?a,int?low,int?high){ ???? ?low?=0; ???? ?high=?a.length-1; ???? int?pivot=?a[low]; ???? //low+=low; ???? int?temp=?0; ???? ???? for(int?i=low+1;i<=high&&a[i]>pivot;i++){ ???? for(int?j=high;i>=low&&a[j]<pivot;j--){ ???? if(i<j){ ???? temp=a[j]; ???? a[j]=a[i]; ???? a[i]=temp; ???? } ???? ???? if(i>j&&low<j){ ???? temp=a[low]; ???? a[low]=a[j]; ???? a[j]=temp; ???? ???? ???? ???? QuickSort1(a,low,j-1); ???? QuickSort1(a,j+1,high); ???? ???? } ???? } ???? ???? return?a; ????} public?static?void?main(String[]?args){ Scanner?input=?new?Scanner(System.in); System.out.println("please?enter?in?..."); int?[]?array?=?new?int?[10]; for(int?i?=?0;i<array.length;i++){ array[i]=input.nextInt(); } ?int?[]arr2?=new?int[10]; int[]?a=QuickSort1(array,?0,?20); for(int?i?=?0;i<array.length;i++){ System.out.println(array[i]); } } }
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 1217 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號