

def closest_values(L):
    'Closest values\n\n    :param L: list of values\n    :returns: two values from L with minimal distance\n    :modifies: the order of L\n    :complexity: O(n log n), for n=len(L)\n    '
    assert (len(L) >= 2)
    L.sort()
    (valmin, argmin) = min((((L[i] - L[(i - 1)]), i) for i in range(1, len(L))))
    return (L[(argmin - 1)], L[argmin])

dataset/ETHPy150Open jilljenn/tryalgo/tryalgo/closest_values.py closest_values/original