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+ " "); }

19th May 2020, 3:52 PM
Shivam Rawal
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);
19th May 2020, 3:58 PM
Manu_1-9-8-5
Manu_1-9-8-5 - avatar
+ 1
Tysm
20th May 2020, 3:33 AM
Shivam Rawal
0
I don't want bubblesort
19th May 2020, 4:38 PM
Shivam Rawal
0
Can u guys tell me what's wrong in my code
19th May 2020, 4:38 PM
Shivam Rawal
0
I have alternatives but wanted to know where I'm wrong in this code
19th May 2020, 4:39 PM
Shivam Rawal