Ms. Whitby's Classroom logo Ms. Whitby's Classroom

Sort the scores

Sorting prepares data for searching and comparison. Try selection sort: repeatedly find the smallest remaining value and move it into the next position.

Your task

Parse the integer arguments and print them in ascending order. Use exactly one space between values and no trailing space. End with a newline. With no values, print an empty line. There are at most 100 values, each between -1000 and 1000.

Example arguments

8 -2 8 3

Expected output

-2 3 8 8

First implement a sorting algorithm yourself. Then compare your work with Arrays.sort in your IDE and explain the time complexity of your algorithm.