with algorithm