In decreasing order

  • 5
The ordered isomorphs of Planet Linear Chaos love to sort and accept into their ranks those who are proficient at sorting. What's that you say? You don't plan on associating with them? That won't work: isomorphs are often the ones conducting interviews at IT companies. We won't ignore them: write a program that reads 20 numbers from the keyboard and displays them in decreasing order.
You can't complete this task, because you're not signed in.
Comments (10)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Mitesh Shah Level 11, London, United Kingdom
24 January 2020, 20:57
My code works, and it verifies correctly, but I am still confused. The sort method is void. It is not returning anything. So how is the sorted array being printed in the correct decreasing order?
Nickolas Johnson Level 8, St. Louis, United States of America
4 April 2020, 14:02
Yeah, I don't get it either. I expected to have to print it out in the sort method.
Adrian Level 20, Spanish Town, Jamaica
25 April 2020, 08:24
the sort method is void, so it doesn't have a data type to return. when we call the function "sort(array)" we pass it a copy of the array and the code in that method changes the array's 'internal state' (sorts it in descending order).
Mitesh Shah Level 11, London, United Kingdom
28 April 2020, 13:16
Thanks, that clears it up for me.
Liew Level 10
29 April 2020, 00:42
remember when we use array its a reference point to an object, so whenever we touch that same object in different methods, what is in the array will change.
Roman Hryhorchuk Level 17, Cracow, Poland
31 October 2020, 20:25
this will explain what is going on
Kent Hervey Level 14, United States
25 November 2019, 05:06
It is still frustrating when I meet what I think are the requirements, but does not verify. I used collections sort then reversed. codegym did not like that. wants me to make my own sorting I did that and it passed. Okay because I learned two ways to do it.
buxiule Level 19, Aptos, United States
17 September 2019, 09:25
why ? i think i'm right. plz help me
MBC Level 14, Apeldoorn, Netherlands
14 July 2019, 15:35
Wait we can use the names sorting algorithms?
Andrew Level 16, Toronto, Canada
4 February 2019, 11:47
Hint: Bubble Sort