Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spomenik Monument Database

Authors: Donald Niebyl, FUEL, Damon Murray, Stephen Sorrell

1st Edition

0995745536, 978-0995745537

More Books

Students also viewed these Databases questions

Question

Why are so many companies adopting yield management systems?

Answered: 1 week ago