Sublinear algorithm.