General algorithm and problem solving