We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b1e5f70 commit 87c0925Copy full SHA for 87c0925
Selectionsort.java
@@ -0,0 +1,27 @@
1
+public class Selectionsort {
2
+ public static void select(int nums[]){
3
+ for(int i=0;i<nums.length;i++){
4
+ int minpos=i;
5
+ for(int j=i+1;j<nums.length;j++){
6
+ if(nums[minpos]>nums[j]){
7
+ minpos=j;
8
+ }
9
10
+ int temp=nums[minpos];
11
+ nums[minpos]=nums[i];
12
+ nums[i]=temp;
13
14
+
15
16
17
+ public static void sel(int nums[]){
18
19
+ System.out.print(nums[i]+" ");
20
21
22
+ public static void main(String[]args){
23
+ int nus[]={1,4,8,5,8,3};
24
+ select(nus);
25
+ sel(nus);
26
27
+}
0 commit comments