选择排序

    public static int[] selectsort(int[] numbers){
    	int length = numbers.length;
    	int index=0;
    	for(int i=0;i<length;i++){
    		index = i;
    	for(int j=i+1;j<length;j++)
    	{
    	 if(numbers[index]>numbers[j]){
    		 index = j;
    	 }
    	}
    	int temp = numbers[index];
    	numbers[index] = numbers[i];
    	numbers[i] = temp;
    	}
    	return numbers;
    }

你可能感兴趣的:(选择排序)