标签:style blog color for ar div log new sp
1 package com.learning.algorithm; 2 3 public class SelectSort { 4 5 public int[] selectSort(int[] arrValue){ 6 int temp = 0; 7 int min; 8 for(int i=0;i<arrValue.length-1;i++){ 9 min = i; 10 for(int j=i+1;j<arrValue.length;j++){ 11 if(arrValue[j]<arrValue[min]){ 12 min = j; 13 } 14 } 15 temp = arrValue[i]; 16 arrValue[i] = arrValue[min]; 17 arrValue[min] = temp; 18 } 19 return arrValue; 20 } 21 22 /** 23 * @param args 24 */ 25 public static void main(String[] args) { 26 int[] arrValue = {89,39,56,93,2,58,43,51,33,67}; 27 SelectSort ss = new SelectSort(); 28 int[] arrResult = ss.selectSort(arrValue); 29 for(int value:arrResult){ 30 System.out.print(value); 31 System.out.print(","); 32 } 33 34 35 } 36 37 }
标签:style blog color for ar div log new sp
原文地址:http://www.cnblogs.com/ryanwangblog/p/3931532.html