wustrive_2008 发表于 2013-2-3 10:24:17

二分排序(java实现)

package com.guxia;public class Test {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=1;i<10;i++){temp=a;low=0;high=i-1;while(low<=high){mid=(low+high)/2;if(a>temp)high=mid-1;elselow=mid+1;}for(j=i-1;j>high;j--)a=a;a=temp;}for(i=0;i<10;i++){System.out.printf("%d",a);}}}
页: [1]
查看完整版本: 二分排序(java实现)