Given a list of pairwise distinct integers, sort it in alternating order: The second number is larger than the first, the third is smaller than the second, the fourth is larger than the third etc. (This order is not unique.) E.g., 5 7 3 4 2 9 1
would be valid output.
Extra points (since this is code golf, subtract from the number of characters):
- 15 for not using any built-in sort functionality.
- 15 if your code does not reorder inputs that are already ordered this way.
- 10 if the output order is random, i.e., multiple runs with the same input yield different correct outputs.