Ascending numbers

  • 10
  • Locked
Perhaps you've already heard about the ordered isomorphs from Planet Linear Chaos. You know, the ones who invented every sorting technique? Today we've received a task from them: the user enters 5 numbers from the keyboard, the method sorts the numbers in ascending order, and then another method displays them on the screen. Are you up to the challenge? If so, maybe you should visit Linear Chaos!
You can't complete this task, because you're not signed in.
Comments (14)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Xavi Martin
Level 22
Expert
11 October 2022, 07:00
can someone explain me the sort method of the example? i don't understand the "temp" variable or anything about the method. thanks.
OBINNA
Level 16 , Texas, United States
5 May 2021, 18:52
using ArrayList; add the numbers to the ArrayList sort it using Collections.sort()method. then iterate and print out the numbers. rem to import java.util.*
Pahunchik
Level 8 , Moscow, Russian Federation
6 May 2021, 11:50
Thanks)
Pahunchik
Level 8 , Moscow, Russian Federation
6 May 2021, 11:52
I did not succeed for a long time because I did not specify the data type of the ArrayList - <Integer>
ImDevin
Level 15 , Old Town, United States
15 April 2021, 02:08
although we haven't hit ArrayList yet, it's so much nicer to use it. only using if/else just takes way too long.
Alaskian7134
Level 22 , Iasi, Romania
4 January 2021, 11:58
i made the program, respect the requirements, still get error: "Should display 5 lines only". this is another example of "if you don't do it our way, is the wrong way". copied their code (without paying attention to it because it was 3 times bigger than mine) and moved on.
Joe
Level 9
8 June 2020, 13:47


For those looking to complete without arrays heres a good explanation https://stackoverflow.com/a/26105101
Petros
Level 23 , Columbia, United States
20 July 2020, 16:33
Thanks. It's complicated but works amazingly. I had to use arrays because using just if/else if statements would be too inefficient, even for me. Now, I have to study why this actually works lol
ziv fisher
Level 9 , Petah Tikva, israel
28 September 2020, 16:03
It cycles through: all of the numbers * size() of array.
Chakshu Gupta
Level 9 , Delhi, India
23 May 2020, 15:08
This code works fine. But is there any way that I can refine it?
Sreekant
Level 10 , Anaheim, United States
31 January 2020, 16:31
what is wrong with my program.. Output matches the requirements
smile
Level 7 , Tainan, Taiwan, Province of China
21 June 2019, 07:08
Is there a better way to do it without arrays?
Vafa
Level 30 , Orumiyeh, Iran, Islamic Republic of
8 September 2019, 21:36
No😑
Kimberly Hughes
Level 8 , San Antonio, United States
16 September 2019, 19:03
Not a better way, but there are ways.