Costs of Finding the Median For a Set of Numbers on Chain
The contracts and testing in this repository was used to find the gas cost for calculating the median from a set of uint on chain.
The conclusion is that finding the median is relatively cheap and creating an ordered list from an unordered one is costly.
For each comparison an array of lengths 2, 3, 4, and 5 was tested.