CSES - Smallest elements

Implement a test, where the input is a list of n numbers and we want to know the sum of the n/10 smallest elements.

Implement first Algorithm 1 that first sorts the list and then computes the sum of the first n/10 elements. Then implement Algorithm 2 that adds the numbers into heap and then retrieves the n/10 smallest elements needed for the sum.

Implement the test so that n=10^6 and each number is chosen randomly from the range 1 \dots 10^9.

In this task, you get a point automatically, when you report your results and the code you used, and press the submit button.

Algorithm 1 run time: s

Algorithm 2 run time: s

The code you used: