-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSelectoinSort.java
38 lines (29 loc) · 934 Bytes
/
SelectoinSort.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/******************************************************************************
Online ava Compiler.
Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.
*******************************************************************************/
import java.util.ArrayList;
public class SelectoinSort
{
public static void main(String[] args) {
int[] list={100,12,15,3,1,10,7,23};
SelectoinSort(list);
Display(list);
}
public static void SelectoinSort(int[] list){
for(int i=0;i<list.length-1;i++)
for(int j=i+1;j<list.length;j++){
if(list[i]>list[j]){
int temp=list[i];
list[i]=list[j];
list[j]=temp;
}
}
}
public static void Display(int[] list){
for(int i=0;i<list.length;i++){
System.out.print(list[i]+" ");
}
}
}