def calc_median(values_list):
    """calculates the median of the list in O(n log n); thus also returns sorted list for optional use"""
    median = 0.0
    sorted_list = sorted(values_list)
    n = len(sorted_list)
    if n == 0:
        return median, sorted_list, n

    half = n >> 1
    if n % 2 == 1:
        median = sorted_list[half]
    else:
        median = 0.5 * (sorted_list[half] + sorted_list[half + 1])
    return median, sorted_list, n