begin choose algrithom