Simple reconstruction of non-simple curves and approximating the median in streams with constant storage