Create a program that gives us the 10 smallest numbers of the input.
The input consists of integer numbers between -1000 and +1000. Two consecutive numbers are separated by either a space or a newline character.
The output contains the smallest numbers, at most 10, in ascending order, separated by single spaces. Each number must appear only once, even if it occurs more than once on the input.
The output may contain less than 10 numbers only if less than 10 different numbers appeared on the input.
Output for Sample Input
Hints and Guide
The simplest data structure to calculate the result is a list implemented with an array. We recommend creating an
One possible solution is available in: main.c.
Inserting a number into an ordered array could have a high cost. To make the application faster, you can replace the array with a linked list.
Acknowledgement This work was supported by the construction EFOP-3.4.3-16-2016-00021. The project was supported by the European Union, co-financed by the European Social Fund.
|University of Debrecen; Faculty of Informatics; v. 03/01/2019|