algorithm 1 000