def calculate_stats(array):
    """Return min, max, avg in the given array.
    """
    _count = 0
    _max = _sum = 0.0
    _min = None
    for number in array:
        _count += 1
        if _min is None or number < _min:
            _min = number
        if number > _max:
            _max = number
        _sum += number
    return {'min': _min, 'max': _max, 'avg': _sum / _count}