Median can be computed in time O(n log n) without sorting using the select-k algorithm. https://github.com/python/cpython/blob/169cdfefce83fabcea48d0ba24ca4dba210f41d0/Lib/statistics.py#L327C1-L348C43