sublinear time algorithm