Median of interval
There are two methods to calculate the median of an interval [low, high].
- m = ( l + h ) / 2- m = l + ( h – l ) / 2
l + h may have addition overflow, but h-l will not. Therefore, it is best to use the second method of calculation.
Enjoy Reading This Article?
Here are some more articles you might like to read next: