index | submit | rank | book

sorting – Sorting

Write a program that sorts any given list of integers, that is, puts them in ascending order.

Sorting integers

Input and Output

Input will consist of several lines each with a list of integers separated by space. The list will not be longer than 100 elements and each element is between 0 and 1000 (inclusive).

For each line of input you should produce a line of output with the same integers in non-descending order, i.e. ascending order.

Example input

3 2 1
2 1 3 4
60 12 360 1080

Example output

1 2 3
1 2 3 4
12 60 360 1080

Scoring

In this exercise, your program does not need to have optimal performance. Using bubble sort, insertion sort or selection sort should be enough to achieve a full score. Expected runtime performance is O(n²) or less.

try first: max-subarray

try next: file-write

index | submit | rank | book

Copyright © 2020-2023 Rudy Matela
All rights reserved