search alg impl