+ 1

How can I do ascending array? From random numbers. In java

suppose I have input 7382190 and I want the result as 0123789 how?

5th Jun 2017, 10:30 PM
Saleh Sayeem
Saleh Sayeem - avatar
5 Antworten
+ 4
Look up some sorting algorithms, perhaps selection or bubble sort to start off. Or, if you're lazy (😝) you can do: import java.util.Collections; Collections.sort(myArray);
5th Jun 2017, 10:37 PM
Rrestoring faith
Rrestoring faith - avatar
+ 4
Same thing with the sorting algorithms (that doesn't change on language). Or, the function would be: myArray.sort()
5th Jun 2017, 10:41 PM
Rrestoring faith
Rrestoring faith - avatar
+ 1
what'll be the solution if I wanna do it on py?
5th Jun 2017, 10:39 PM
Saleh Sayeem
Saleh Sayeem - avatar
+ 1
thank u by the way 😊
5th Jun 2017, 10:42 PM
Saleh Sayeem
Saleh Sayeem - avatar
0
Collections.reverse(myArray); another useful bit. If you want your array to go highest to lowest
6th Jun 2017, 12:00 AM
LordHill
LordHill - avatar