I have a function $f(x)$, has been sampled into a sequence $$ y_0, y_1, ..., y_{n - 1} $$ at points $x_k = k \Delta x$. $f(x)$ is neither smooth or monotone.
Under this assumption, what is the fastest way of finding $$ \min_{k=0}^{n - 1}|P - (x_k, y_k)| $$ where $P$ is an arbitrary point?
I could do a linear search, but I need to compute the minimum distance for $n^2$ different points which makes the overall algorithm $n^3$.