|
Algorithm::MedianSelect - Median finding algorithm |
Algorithm::MedianSelect - Median finding algorithm
use Algorithm::MedianSelect qw(median);
@num_items = qw(1 2 3 5 6 7 9 12 14 19 21);
print median(\@num_items);
This module finds the item which is smaller than half of the items and bigger than half of the items. Numbers and character strings are processed; character strings are evaluated by their length. Mixed types are unsupported.
Returns the median item.
$median = median(\@items);
http://www.cs.sunysb.edu/~algorith/files/median.shtml
|
Algorithm::MedianSelect - Median finding algorithm |