in reply to Finding Median of an Array after an Infinite Loop
Did you search ? You will find several modules that will do the computation for you. Even if you do not use them, they should be great examples.
If you wish to do it yourself for the learning experience, sort the array. (Be sure to use numeric sort. It is not the default) If you have an odd number of elements, choose the middle one. Otherwise, take the average of the middle two elements. You will probably find the function int useful in finding the middle.
|
|---|