0
Can anyone correct my code for sorting array
If array length is 5 for(int l =0;l<=4;++l){ s=l; for(int m=l;m<=4;++m){ if(o[m]<o[s]){ s=m; } temp=o[l]; o[l]=o[s]; o[s]=temp; } } for(int u:o){ System.out.print(u+ " "); }
5 Respostas
+ 1
If you are not trying to learn how sorting works and going to implement it:
import java.util.Arrays;
...
Arrays.sort(o);
+ 1
Tysm
0
I don't want bubblesort
0
Can u guys tell me what's wrong in my code
0
I have alternatives but wanted to know where I'm wrong in this code