finding suitable alg