tables with algorithm