Given a list of numbers, we say that an element is weak on average if it is smaller than the average of the previous numbers. We consider that, if a list is not empty, the first element is not weak on average. Design an iterative operation that, given a non empty list of double l, puts in another list the result of extracting from l the weak elements on average. Use the following specification:
For example, if list l is
then list sel must be
and if list l is
list sel must be
Input
The input is a list of double.
Output
The output is a list like the input one but without the weak on average elements.
Observation
You only have to submit a file that contains the function with the header in the statement as well as any other auxiliary function that you think necessary, without any function main. Also add the includes for any class that you use.