The old code in fact increased the complexity to O(n^2), because
we applied 'elem' which is O(n) to every element of xs.
Instead we compare (in case of partitioning against Y) the y-value
of every element of xs with the y-value of the pivot which tells us
if x lies within ys.