public class selections {
private void selectsort(int[] a){
int large = 0;
int length = a.length-1;
int temp;
for(int i = 0; i < a.length; i++){
while(length > 0){
if(large > a[i]){
large = a[i];
}
length--;
}
temp = a[i];
a[i] = a[length];
a[length] = temp;
}
for(int b = 0; b < a.length; b++){
System.out.print(a[b] + " ");
}
}
public static void main(String[] args) {
int[] a = { 23, 45, 12, 20, 10, 4, 46 };
selections ss = new selections();
ss.selectsort(a);
}
}
This post has been edited by javabrijon: 29 October 2009 - 02:52 AM

New Topic/Question
Reply




MultiQuote








|