选择法排序数组+折半查找判断输入的数是否在数组中

package com.shu;
import java.util.*;

public class example2_5 {
	public static void main(String[] args) {
	int start=0,end,middle;
	int a[] = {23,120,34,3,78,90,12,236};
	int N = a.length;
	//选择法排序数组
	for(int i=0;ia[middle]){
			start = middle;
		}else if(numberN/2){break;}
		}
	if(count>N/2){
		System.out.printf("%d不在数组中",number);
	}else{
		System.out.printf("%d在数组中",number);
	}		
	}
}

 

转载于:https://www.cnblogs.com/wx1993/p/4680070.html

你可能感兴趣的:(选择法排序数组+折半查找判断输入的数是否在数组中)