24. Sort Three Numbers
Core1000 ms256 MBSolved by 0%
Read three integers and print them in ascending order on one line, separated by single spaces.
Do this with comparisons only, the point of the exercise is to reason about ordering directly, not to call a sort function.
Constraints - `-1000000 ≤ a, b, c ≤ 1000000`
Input
A single line containing three integers, separated by spaces.
Output
Print the three integers in ascending order on one line, separated by single spaces.
Input3 1 2
Output1 2 3
Noteneeds all three values moved
Input1 2 3
Output1 2 3
Noteis already sorted and must be left alone
Hints
Four rungs, in order. The last two open once you have submitted an attempt. A wrong one counts.
Hint 1Where to start
Hint 2The approachOpen hint 1 first. This one carries on from it.
Hint 3PseudocodeOpen hint 2 first. This one carries on from it.
Hint 4Full solutionOpen hint 3 first. This one carries on from it.