+ 1
how to order an arrangement of numbers, in a decreasing way?
2 Réponses
+ 5
Here is the bubble sort lesson code.
edited to high to low
https://code.sololearn.com/cQFvwk6MgYsY/?ref=app
+ 2
It does not matter whether you are sorting your arrangement in an increasing way or a decreasing one. It's the same issue: "Sorting".
Let's take an array of numbers and sort it in an increasing way. You receive an array with its elements in increasing order. Then flip your array. This means you turn it upside down - your first element becomes the last one and the other way round. There you go - you'll receive an array with its elements sorted in a decreasing way. You actually transformed the array with an increasing order to one with a decreasing order. Furthermore this works the other way round, too.
To learn about sorting you can read this section :
https://www.sololearn.com/learn/774/?ref=app
Actually, you can modify most sorting algorithms for sorting to an increasing order on a way they sort in a decreasing order. This is mostly done by switching the conditions from < to > or the other way round.
A good hint for the future: " Sometimes it's easier to transform your issue to an other with given solutions than try to create a solution for the first one on your own. "
If you have further questions, feel free to ask.
Happy Holidays