+ 4

Error in SelectionSort_JAVA !!!

what's the problem? help me to solve it thank you^

22nd Jan 2018, 1:28 PM
Reza
Reza - avatar
6 Réponses
+ 17
where is the code ? //without any code we can't figure out where is the error edit ::: public class Program { public static void main(String[] args) { int[] arr = new int[]{3,8,2,5,9,10,1,4,7,6}; int min; int temp = 0; for(int i = 0;i<=arr.length-2;i++) for(int j=i+1;j<=arr.length-1;j++) if(arr[j] > arr[i]) { min = j; temp = arr[i]; arr[i] = arr[min]; arr[j] = temp; } for(int i=0;i<arr.length;i++) { System.out.println(arr[i]); } } }
22nd Jan 2018, 1:58 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 7
Insert a code to your post please
22nd Jan 2018, 2:22 PM
Infinity
Infinity - avatar
+ 2
Could you please post your code, then we can help you.
22nd Jan 2018, 1:46 PM
Jonas Schröter
Jonas Schröter - avatar
+ 2
excuse me i have been joined to solo recently i am amature
22nd Jan 2018, 3:47 PM
Reza
Reza - avatar
+ 2
Yeah! it worked .... thanks guys ;D
22nd Jan 2018, 5:39 PM
Reza
Reza - avatar