Question: In this problem, you will develop a new function in our provided LinkedList class. Please observe the already existing structures found in LinkedList.h . Create

In this problem, you will develop a new function in our provided LinkedList class. Please observe the already existing structures found in LinkedList.h.
Create a new function named getStats. This function should take in no parameters and return an int*.
This function should:
Allocate an array on the heap.
Calculate the minimum of all nodes, maximum of all nodes, and the mean of all nodes. These numbers should be stored as integers. If the mean is a decimal value, round it down to the lower integer.
Return the pointer to the first element in the return array. The return array should be structured as [min, max, mean].
If head is nullptr, then your return array should have all three elements set to zero.
Minimum (Min):
The minimum value in a dataset is the smallest value.
For example, in the set of values 3,5, and 7, the minimum value is 3.
Maximum (Max):
The maximum value in a dataset is the largest value.
For example, in the set of values 3,5, and 7, the maximum value is 7.
Mean (Average):
The mean, or average, is calculated by summing all the values in a dataset and then dividing by the number of values.
For example, if you have the values 3,5, and 7, the mean would be (3+5+7)/3=15/3=5.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!