Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Finding Median of an Array after an Infinite Loop

by BillKSmith (Monsignor)
on Nov 27, 2019 at 21:07 UTC ( [id://11109326]=note: print w/replies, xml ) Need Help??


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.

Bill
  • Comment on Re: Finding Median of an Array after an Infinite Loop

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11109326]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2024-04-25 21:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found