Creating a function

Normalising a set of data points to the interval [0,1]. Each data point is normalised as follows:
Po = (P - min)/(max - min)
Po = the normalised value
P = the un-normalised value
min = the minimum value in the set
max = the maximum value in the set

Write a function for normalising data points using the signature below.
void normaliseRange (float data [], int array_size)

How do you do this?
I think it would need two passes through the array. First, simply find the max and min. Then process each element one at a time to assign the new value according to the algorithm.
Topic archived. No new replies allowed.